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

Still need help?

The Atlassian Community is here for you.

Ask the community

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

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: 

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 

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

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

Query 2: check app_user  table

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


tip/resting Created with Sketch.

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):

    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):

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

Last modified on Jan 18, 2023

Was this helpful?

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