User already registered

On this page

Short answer

supabase.auth.signUp() was called with an email or phone number that already has an account. Check error.code for user_already_exists, then send the person to sign in with signInWithPassword() or to reset their password. If both Confirm email and Confirm phone are on, Supabase returns a fake user and no error instead, so don't treat a returned user as proof of a new account.

Find a fix pack

Checklists and prompts for Supabase security, Stripe payments and deploys. Each pack is $24, or $49 for all three.

The exact error you'll see

Supabase Auth returns this message from the sign-up endpoint:

User already registered

Source: https://github.com/supabase/auth/blob/master/internal/api/signup.go (opens in a new tab)

The error code is user_already_exists. Supabase defines it as: "User with this information (email address, phone number) cannot be created again as it already exists."

Source: https://supabase.com/docs/guides/auth/debugging/error-codes (opens in a new tab)

Applies to

  • Email and password sign-up with supabase.auth.signUp() in supabase-js v2
  • Sign-up and login forms in Lovable, Bolt and Cursor apps that use Supabase Auth
  • Settings involved: Confirm email and Confirm phone under the project's Auth providers

Why it happens

  • The account exists. Someone who already signed up is using the sign-up form again.
  • The login form calls the wrong method. signUp() creates users. signInWithPassword() is the one that will "Log in an existing user with an email and password or phone and password."
  • Your confirmation settings decide what you see. The signUp() reference says that when either Confirm email or Confirm phone is disabled, "the error message, User already registered is returned." When both are enabled, "an obfuscated/fake user object is returned." Both rules apply "even when phone provider is disabled."

How to fix it, step by step

  1. Check which method each form calls. Keep signUp() on the sign-up form. The login form should call signInWithPassword(). This is Supabase's example:
const { data, error } = await supabase.auth.signInWithPassword({
  email: 'example@email.com',
  password: 'example-password',
})
  1. On the sign-up form, check error.code, not the message text. Supabase says: "Always use error.code and error.name to identify errors, not string matching on error messages." When the code is user_already_exists, show a message with a link to sign in.
  2. Offer a password reset next to it. resetPasswordForEmail() "Sends a password reset request to an email address." Supabase says it's "used together with updateUser()," which sets the new password after the user follows the link.
  3. Check Confirm email and Confirm phone in your Supabase project. If both are on, a repeat sign-up won't return this error at all. Show the same neutral message, such as asking them to check their inbox, whether or not the account is new.
  4. Test both paths with addresses you control: one new address, and one that already has a confirmed account.

What the docs don't spell out

  • The fake user is there to protect privacy. In Supabase Auth's code, the function that builds it "Should be used whenever we want to prevent information about whether a user is registered or not from leaking." Don't build UI that tells people whether an email has an account. (Auth signup.go (opens in a new tab))
  • The phone setting matters on an email-only form. The rule covers Confirm phone "even when phone provider is disabled," so check it before deciding the behavior is a bug. (supabase-js GoTrueClient.ts (opens in a new tab))
  • Sign-in errors are vague on purpose too. Supabase warns that a sign-in error may "not distinguish between the cases where the account does not exist or that the email/phone and password combination is wrong or that the account can only be accessed via social sign-in." (JavaScript reference (opens in a new tab))

How to check it worked

  • Signing up with an existing address shows your "already registered" message or your neutral message, depending on your confirmation settings.
  • The login form signs in an existing user without calling signUp().
  • The reset link lets the user set a new password and sign in.

Sources

  1. https://github.com/supabase/auth/blob/master/internal/api/signup.go (opens in a new tab): exact message, ErrorCodeUserAlreadyExists, sanitized user to avoid leaking registration
  2. https://supabase.com/docs/guides/auth/debugging/error-codes (opens in a new tab): user_already_exists definition, use error.code not message text
  3. https://supabase.com/docs/reference/javascript/auth-signup (opens in a new tab): Confirm email and Confirm phone behavior for existing users
  4. https://github.com/supabase/supabase-js/blob/master/packages/core/auth-js/src/GoTrueClient.ts (opens in a new tab): same rules in the SDK, including "even when phone provider is disabled"
  5. https://supabase.com/docs/reference/javascript/auth-signinwithpassword (opens in a new tab): signInWithPassword() example, vague sign-in errors
  6. https://supabase.com/docs/reference/javascript/auth-resetpasswordforemail (opens in a new tab): password reset request, used with updateUser()

Tool to consider: Supabase.

Find a fix pack

Checklists and prompts for Supabase security, Stripe payments and deploys. Each pack is $24, or $49 for all three.