Jira server throws there is no ID mapped for the user key error

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

Problem

No problem is noticed on the regular usage, however the following exception appears in the atlassian-jira.log when trying to create issues or send mail notifications for issue activities:

1 2 3 4 5 6 7 2015-07-08 16:43:02,465 http-bio-8080-exec-99 ERROR admin 1003x52096x1 xe4oev 10.0.0.8 /secure/CommentAssignIssue.jspa [atlassian.event.internal.AsynchronousAbleEventDispatcher] There was an exception thrown trying to dispatch event [com.atlassian.jira.event.issue.DefaultIssueEventBundle@25b22747] from the invoker [SingleParameterMethodListenerInvoker{method=public void com.atlassian.jira.event.listeners.mail.MailListener.handleIssueEventBundle(com.atlassian.jira.event.issue.IssueEventBundle), listener=com.atlassian.jira.event.listeners.mail.MailListener@28efb47d}] java.lang.RuntimeException: There is no ID mapped for the user key 'testuser' at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) at com.google.common.util.concurrent.MoreExecutors$SameThreadExecutorService.execute(MoreExecutors.java:253) at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:107) at com.atlassian.event.internal.EventPublisherImpl.invokeListeners(EventPublisherImpl.java:160)

or

1 2 3 2018-09-28 08:33:58,330 http-nio-8080-exec-120432 ERROR admin_user 513x41379501x1 32fnvs 10.122.130.50,10.122.140.22 /rest/schizophrenia/1.0/switchuser/possibleusers [c.a.p.r.c.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service: There is no ID mapped for the user key 'testuser' java.lang.IllegalStateException: There is no ID mapped for the user key 'testuser' [..........]

Diagnosis

Run the following queries on JIRA database (replace 'testuser' with the user name mentioned on the stack trace of the error):

Query 1: check userassociation table

1 2 3 SELECT * FROM userassociation WHERE association_type = 'WatchIssue'  AND source_name = 'testuser';

Query 2: check app_user table

1 2 SELECT * FROM "app_user" WHERE "user_key"='testuser';

If none of the queries come back with a result, please contact Atlassian Support.

Cause 1

If query 1 comes back with results, there are entries on userassociation table, related to the watchers list on issues, that are referencing to non-existent users on cwd_user table. Follow the steps in solution 1 to fix the issue.

Cause 2

if query 2 comes back with results, there are entries in the app_user table, referencing non-existent users on the cwd_user table. Follow the steps in solution 2 to fix the issue.

Resolution

Before proceeding, perform a database backup, as the next steps will require delete operations on the database and a rollback may be needed in case of any issues

Solution 1

  1. Shutdown JIRA.

  2. Run the following statement (replace 'testuser' with the user name mentioned on the stack trace of the error):

    1 2 3 DELETE FROM userassociation WHERE association_type = 'WatchIssue'  AND source_name = 'testuser';
  3. Restart JIRA and run a full re-index.

Solution 2

  1. Shutdown JIRA.

  2. Run the following statement (replace 'testuser' with the user name mentioned on the stack trace of the error):

    1 2 DELETE FROM app_user WHERE  "user_key" = 'testuser';
  3. Restart JIRA and run a full re-index.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.