Unable to autocomplete some usernames in Jira Data Center
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
When typing usernames in Jira fields like Assignee, Reporter, or @mentioning users in comments, some usernames will show up in autocomplete, and others will constantly fail.
In the browser's console, you may see errors like:
"Exception: Uncaught TypeError: Cannot read properties of undefined (reading 'issues')"
Environment
All versions of Jira 8.x.
Diagnosis
You may observe this behavior for what seems to be all usernames or just some, while others work.
1) Log evidence
While reproducing the issue, watch Jira's atlassian-jira-log for a similar message:
1
2022-01-13 13:47:25,668-0500 https-jsse-nio-443-exec-178 url: /rest/api/1.0/users/picker; user: redacted-username ERROR redacted-username 827x22791155x2 5ub999 192.168.0.1 /rest/api/1.0/users/picker [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: User 'some-jira-user' has no unique key mapping.
The key is the "has no unique key mapping":
1
2
$ cat application-logs/atlassian-jira.log | egrep -o "User '.*?' has no unique key mapping" | sort | uniq -c
62 User 'some-jira-user' has no unique key mapping
2) Database evidence
For each username that's returned in the grep
above, check if they have the same lower_user_name in both tables below or if in one of them, there's a trailing #1 or other number:
1
2
select * from app_user where lower(lower_user_name) like '%some-jira-user%';
select * from cwd_user where lower(lower_user_name) like '%some-jira-user%';
Cause
If both the log and database evidences above are confirmed, it means Jira has lost consistency of this user's record. The lower_user_name
of both tables app_user
and cwd_user
should always match.
Among possible root causes are:
The user was renamed at some point and the change synced into Jira. Even if the change was reverted in the underlying User Directory, Jira wasn't able to recover on it's own
Some duplicate username came in through the User Directory sync. Even if the duplicate was soon fixed, Jira wasn't able to figure out on it's own on further syncs.
There were changes on key attributes to Jira in the User Directory, like a user's
objectGUID
orsAMAccountName
and Jira wasn't able to resolve the conflict.
In all these situations, we'll see #1 or other numbers appended to usernames in Jira's database.
Solution
1) Full directory sync
The first advised approach is to force a full directory sync. You may trigger it by editing the LDAP directory, saving it without any changes and press the resync button.
Jira will understand that the directory has been recently edited and will force a full sync instead of trying an incremental one.
If the issue persists, try the next solution.
2) Manual intervention
We may manually fix the DB records with the following steps — though it requires some downtime. We also advise following the steps in a non-production instance first to validate it to your scenario and get used to the commands:
Stop Jira (all nodes).
Back up Jira's database to be used in a rollback/backout if needed.
Update the mismatched record(s). The example's for username "some-jira-user#1":
1
update app_user set lower_user_name = 'some-jira-user' where lower_user_name = 'some-jira-user#1';
Commit the DB changes and start Jira.
Confirm if usernames show up when autocompleting and if there is no other similar evidence in the logs.
After fixing a username, others may show up in the logs when searching/autocompleting a username. Repeat the Diagnosis and Resolution steps for each.
Was this helpful?