[GH-ISSUE #1759] Username plugin is using errors from Two factor plugin #8902

Closed
opened 2026-04-13 04:09:05 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @TheYoxy on GitHub (Mar 10, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1759

Hi,

While looking to use the error codes from Username plugin, I tried to use the errors codes as described here.
When looking, I've seen that the errors used in the username plugin are not the one described inside the plugin and then cannot be referenced by using $ERROR_CODES from the auth instance.

The errors used inside the plugin:
f90581d7ab/packages/better-auth/src/plugins/username/index.ts (L40-L48)

The errors that are returned from the plugin and inferred for $ERROR_CODES
f90581d7ab/packages/better-auth/src/plugins/username/index.ts (L9)
f90581d7ab/packages/better-auth/src/plugins/username/index.ts (L304)

Is that the expected behavior or should the errors described in the plugin ?
(I can open a PR to fix it if needed.)

Originally created by @TheYoxy on GitHub (Mar 10, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1759 Hi, While looking to use the error codes from Username plugin, I tried to use the errors codes as described [here](https://better-auth.vercel.app/docs/concepts/client#error-codes). When looking, I've seen that the errors used in the username plugin are not the one described inside the plugin and then cannot be referenced by using `$ERROR_CODES` from the `auth` instance. > The errors used inside the plugin: > https://github.com/better-auth/better-auth/blob/f90581d7ab0493fb58d3c2654c326f6f28a684b3/packages/better-auth/src/plugins/username/index.ts#L40-L48 > The errors that are returned from the plugin and inferred for `$ERROR_CODES` > https://github.com/better-auth/better-auth/blob/f90581d7ab0493fb58d3c2654c326f6f28a684b3/packages/better-auth/src/plugins/username/index.ts#L9 > https://github.com/better-auth/better-auth/blob/f90581d7ab0493fb58d3c2654c326f6f28a684b3/packages/better-auth/src/plugins/username/index.ts#L304 Is that the expected behavior or should the errors described in the plugin ? (I can open a PR to fix it if needed.)
GiteaMirror added the locked label 2026-04-13 04:09:05 -05:00
Author
Owner

@Lukem121 commented on GitHub (Mar 11, 2025):

bump

<!-- gh-comment-id:2714234746 --> @Lukem121 commented on GitHub (Mar 11, 2025): bump
Author
Owner

@Bekacru commented on GitHub (Apr 12, 2025):

fixed

<!-- gh-comment-id:2799040334 --> @Bekacru commented on GitHub (Apr 12, 2025): fixed
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8902