Migrating External Memberships Fail Due to Violation of UNIQUE KEY Constraint for cwd_unique_membership

Still need help?

The Atlassian Community is here for you.

Ask the community


When running the script for migrating the external memberships in admin/migrate-external-memberships.action, it fails.

The following appears in the atlassian-confluence.log:

2013-11-09 23:46:01,042 INFO [Long running task: Migrate External Memberships] [atlassian.crowd.directory.DelegatedAuthenticationDirectory] importMembership Imported user "Michael XYZ"'s membership of remote group "Group Name" to directory "Delegated Authentication Directory".
2013-11-09 23:46:01,167 ERROR [Long running task: Migrate External Memberships] [sf.hibernate.util.JDBCExceptionReporter] logExceptions Violation of UNIQUE KEY constraint 'cwd_unique_membership'. Cannot insert duplicate key in object 'dbo.cwd_membership'.


There are two different entities in LDAP are found with the same value for that attribute (CN). There is a feature request for this:  CONF-23213 - Getting issue details... STATUS


  1. Change the Group Search Filter in the User Directory Configuration so that it excludes the offending group. Example:

    (&(objectclass=groupOfNames)(!(CN=Group Name)))
  2. Perform the migration again


If users are not able to log into Confluence after the migrations completes, please change the Group Search Filter back to the previous filter.


Last modified on Mar 30, 2016

Was this helpful?

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