"User Already Exists" Error When Creating New User

Overview

This article explains why an error may occur when attempting to migrate users to a database connection or when creating users via email. The specific error experienced is:

429 user already exists

This situation can occur even when an attempt to search for the email address or an attempt to use the getByEmail API does not return any results for the user.

Applies To

  • Database Connections
  • New Users

Solution

Follow the steps or video below:

This error is often observed with Custom Databases (DBs), regardless of whether import mode is ON or OFF. To address this, investigate the following potential causes and resolutions:

  • Incorrect “Get User” Script Behavior in Custom Database (DB): The “Get User” script is executed by Auth0 before user creation to verify if the user already exists in the external Custom DB. If the script incorrectly returns a user profile instead of null for a non-existent user, Auth0 will prevent creation, interpreting it as the user already existing.
    • Test the script by navigating to the “Get User” script settings for the Custom DB and selecting the Test button.
    • Ensure the script is configured to return null when a user does not exist in the external DB.
  • User Changed Password but Has Not Signed In: This situation can occur if:
    • The user completed a password reset process (e.g., by selecting a Forgot your password? option) but did not sign in afterward.

    • A Custom DB with Import Mode ON is in use.In this state, Auth0 stores the new password in a temporary record. This record may not be discoverable through user searches, as a full user profile might not yet be imported into Auth0. However, it prevents a new user creation because it would conflict with the password the user chose.To resolve this, choose one of the following recovery methods:

      • Option 1: User Sign-In
        • Instruct the user to sign in using the password they recently set.
        • If the user does not recall the password, they can initiate the password reset process again.
      • Option 2: Delete User Record from Auth0

NOTE: If the user was able to perform a password reset, it implies the user already exists in the external DB. Deleting this Auth0 record removes the new password from Auth0’s temporary storage. Consequently, the user will need to use their previous password (stored in the external DB) to sign in or reset their password again if that original password is not known.