Multiple entries with same key error while syncing from external user directory
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Syncing from an external user directory shows Multiple entries with same key error in the logs. The last synchronization status at the Cog icon > Overview > User Directories page mentions: "Synchronisation failed. See server logs for details."
Environment
Bamboo 7.x versions
Related to:
BAM-20735 - Getting issue details... STATUS
BAM-21700 - Getting issue details... STATUS
CWD-5182 - Getting issue details... STATUS
Diagnosis
java.lang.IllegalArgumentException: Multiple entries with same key errors can be found at the atlassian-bamboo.log
file:
java.lang.IllegalArgumentException: Multiple entries with same key:
[
id=1234,
name=newuser,
createdDate=2020-11-06 09:46:07.0,
updatedDate=2020-11-06 09:46:07.0,
emailAddress=new.user@email.com,
firstName=New,
lastName=User,
displayName=New User,
lowerName=nuser,
directoryId=123456789,
externalId=123:0ce0e16489003840a44430bf8201bba5
]
[
id=5678,
name=olduser,
createdDate=2020-03-16 13:12:03.0,
updatedDate=2020-10-30 17:46:14.0,
emailAddress=old.user@email.com,
firstName=Old,
lastName=User,
displayName=Old User,
lowerName=ouser,
directoryId=123456789,
externalId=123:0ce0e16489003840a44430bf8201bba5
]
Cause
This error is caused by a change to one or more of the following user's information in the external user directory:
- name
- first name
- last name
- email address
Solution
- Stop Bamboo.
- Backup Bamboo database.
- Get the old user id from the message found in the
atlassian-bamboo.log.
Run the following queries against the Bamboo database:
DELETE FROM CWD_USER_ATTRIBUTE WHERE USER_ID = 5678; DELETE FROM CWD_MEMBERSHIP WHERE CHILD_ID = 5678; DELETE FROM CWD_USER_CREDENTIAL_RECORD WHERE USER_ID = 5678; DELETE FROM CWD_USER WHERE ID = 5678;
Replace 5678 with the old user id found in the
atlassian-bamboo.log
- Start Bamboo back