User Not Found Error When Updating Users imported from a Custom Database (Import Mode ON)
Last Updated:
Overview
This article addresses an error that occurs when an attempt is made to update a user whose migration from a custom database has not been finalized. The following error is returned:
User not found
Applies To
- Custom Database
-
User Migration
-
Auth0 Management API
Cause
The User not found error occurs because the migrated user exists only as a "shell" or "placeholder" record in Auth0. Although the user is visible in the User list, the migration is not considered fully complete until the user signs in and sets a password. Any attempt to modify attributes (for example, the username) before this final step fails, as the system cannot operate on the incomplete "shell" profile.
Solution
Resolve this issue by using the Auth0 Management API to first manually finalize the user's migration and then apply the intended update.
-
Finalize the user migration by forcing the migration to complete. Send a
PATCHrequest to theapi/v2/users/<id>endpoint with a temporary, randomly generated password. Enter the following in the request body:{ "password": "<a-strong-random-temporary-password>" }This action finalizes the migration, moving the user from a "shell" profile to a complete, active account.
-
Once the user is fully migrated (after step 1 succeeds), send a second
PATCHrequest to the sameapi/v2/users/<id>endpoint to update the user attributes as intended. Enter the intended attribute changes in the request body. For example:{ "username": "<newusername>" }
NOTE: After programmatically setting a temporary password in step 1, it is highly recommended to immediately trigger a password reset flow for that user. This ensures the temporary password is invalidated, and the user is required to create a private, secure password upon their next sign-in.