"DUPLICATED_USERS" error during Bulk User Import and Lazy Migration

Problem Statement

When bulk importing users from a legacy database connection, we noticed a lot of DUPLICATED_USERS errors when sending the user_id and the “upsert” value as true.


  • The DUPLICATED_USERS error occurs to some users when using the Management API bulk user import endpoint with the user_id and upsert=true
  • If the user_id is not sent in the JSON payload, a duplicate user gets created
  • The CONFLICT_USERNAME error occurs if the tenant flag import_user_match_user_profile_on_user_id is set
  • Custom DB with import mode switched on

Steps to reproduce

  • Log a user in through a custom DB with import mode off
  • Turn import mode on and import the user through the Management API


Using both types of user migration, namely, lazy migration and bulk user imports, can result in the DUPLICATED_USERS error when trying to import users that logged in before turning import mode on.

This creates a partial user record in Auth0 that causes the duplicated user error (AKA importing ghost/zombie users).


The current solution is to delete the users with the Management API Delete a User endpoint to remove the infected record from Auth0 and re-import them.

We understand that this is not ideal, hence, our Engineering teams are working on another possible solution through their backlog.