[PR #5699] fix: delete duplicate email existence check in changeEmail endpoint #14411

Closed
opened 2026-04-13 09:27:41 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5699

State: closed
Merged: Yes


Just noticed this while skimming through the code, so I thought I might as well fix this and open a PR


Summary by cubic

Removed the duplicate email existence check in the changeEmail endpoint and standardized the error response. This reduces unnecessary DB calls and returns 422 UNPROCESSABLE_ENTITY with BASE_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL when the email is already taken.

Written for commit 4ccfc1f0a0. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5699 **State:** closed **Merged:** Yes --- Just noticed this while skimming through the code, so I thought I might as well fix this and open a PR <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Removed the duplicate email existence check in the changeEmail endpoint and standardized the error response. This reduces unnecessary DB calls and returns 422 UNPROCESSABLE_ENTITY with BASE_ERROR_CODES.USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL when the email is already taken. <sup>Written for commit 4ccfc1f0a0418ac26d358a3694f121d3aab36084. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:41 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14411