UserAlreadyExistsException thrown during user migration in Jira server

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms 

The error "User already exists in directory" is thrown when you attempt to migrate users from JIRA Directory to a Delegated Directory.

The following error appears in the atlassian-jira.log:

2014-09-23 15:10:34,770 http-bio-8080-exec-14 ERROR admin 910x1748x1 lx1zni 0:0:0:0:0:0:0:1 /plugins/servlet/embedded-crowd/directories/migrate/ [embedded.admin.directory.MigrateDirectoryUsersController] User migration failed
java.lang.RuntimeException: com.atlassian.crowd.exception.UserAlreadyExistsException: User already exists in directory [10002] with name [jira1]

Causes

There is an existing user in the directory. If you check the error message below, jira1 user is exist in Directory ID = 10002.

User already exists in directory [10002] with name [jira1]

Diagnosis

If you would like to know which users are not migrated to the Directory, you can run the following SQL query and check the returned results:

select directory_id, lower_user_name, active from cwd_user where directory_id = '<directory_id>' AND lower_user_name not in (select lower_user_name from cwd_user where directory_id = '<destination>');

(info) Replace <directory_id> and <destination> accordingly.

Resolution

If the user does not exist in the directory, you can refer the following resolution steps:

  1. Disable the current failing delegated ldap directory.
  2. Create a new Internal With LDAP Authentication directory and leave the option Copy User on Login disabled for the moment. If needed you can go back and re-enable the copy option once this is complete.
  3. Move the newly created directory to the top of the directory list.
  4. Complete your migration.

Managing 500+ users across Atlassian products?
Find out how easy, scalable and effective it can be with Crowd!
See centralized user management.
Last modified on Mar 24, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.