Auth0 Home Blog Docs

Issue when trying to recreate a deleted user



Today we deleted one of our users.

We have been trying to add a user with the same email address but we keep on getting a this user already exists message. The user cannot be found in the list of users (dashboard and API).

Is there something we are missing?


Given this will be specific to the user in question you’ll need to provide additional information, in particular, the tenant/account, the user identifier or email address, a time frame from when the deletion occurred, the method through which the user was deleted, any other information you think can be relevant. Some of the information required is sensitive so share it through a restricted to emails.


All information is in the sharelock:


Thanks for providing the information requested; I had a look at the user in question and the user seems to be associated with a custom database connection with import mode enabled. I tried to reproduce this locally with pseudo-real custom database connection scripts and I would get the error in question if:

  • I deleted an already migrated user ( from Auth0 using the DELETE /api/v2/users/{id} endpoint.
  • I would then try to create a user with the email ( in Auth0 using the POST /api/v2/users endpoint.

However, in the above scenario the error is expected as you only deleted the user from Auth0 and when you then try to create the user through Auth0 Management API the connection will trigger the get user custom database script that on my case it would return a user profile signaling that the user does already exist.

In the above scenario the expectation is that migrated users that are only deleted from Auth0 will be created when they try to authenticate again. If you want to create users through Auth0 then they must not exist in the custom store (aka the get user script must not return any profile information).

Finally, the above is just a theory because since the issue involves a custom database connection (with code provided by yourself) I cannot replicate the exact same conditions so if this theory completely missed the underlying issue for your scenario then you’ll need to provide additional information about the global use case and how your custom scripts are reacting, in particular, for the user in question.