Jira throws "Caused by: java.lang.IllegalArgumentException: Passed List had more than one value" when viewing an issue

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

When viewing an issue, Jira will throw a 500 error.

The following appears in the atlassian-jira.log

2016-08-02 09:34:28,294 http-bio-8080-exec-12897 ERROR admin 574x2578725x4 1k1bb6 192.168.2.122,192.168.32.44 /rest/api/2/issue/TEST-123 [jira.rest.exception.ExceptionInterceptor] Returning internal server error in response
java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor1000.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    ...
Caused by: java.lang.IllegalArgumentException: Passed List had more than one value.
    at org.ofbiz.core.entity.EntityUtil.getOnly(EntityUtil.java:62)
    at com.atlassian.jira.issue.managers.DefaultIssueManager$IssueFinder.getIssueFromIssueEntityByProjectAndNumber(DefaultIssueManager.java:1251)
    at com.atlassian.jira.issue.managers.DefaultIssueManager$IssueFinder.getIssueFromIssueEntity(DefaultIssueManager.java:1246)
    at com.atlassian.jira.issue.managers.DefaultIssueManager$IssueFinder.getIssue(DefaultIssueManager.java:1216)
    at com.atlassian.jira.issue.managers.DefaultIssueManager.getIssue(DefaultIssueManager.java:156)
    at com.atlassian.jira.issue.fields.rest.IssueFinderImpl.findIssueByKey(IssueFinderImpl.java:84)
    at com.atlassian.jira.issue.fields.rest.IssueFinderImpl.findIssue(IssueFinderImpl.java:66)  <+2> (DelegatingMethodAccessorImpl.java:43)
    ...

When running a REST call to grab information of this issue (eg. GET for /rest/api/2/issue/{IssueKeyorID}), the same error is thrown in the logs

Cause

There are multiple entries in the jiraissue table which has the same values for the project and issuenum column

Resolution

There are several options to resolve this

Option 1

Remove one of the entries via the JIra UI

  1. Determine the issue key which is affected. In this case, it is TEST-123
  2. Run the following query against the database to determine the id and summary of the duplicate issues

    select id, summary, description from jiraissue where issuenum=<number> and project=(select id from project where pkey='<project key>');

    (info) Replace <number> and <project key> with the affected issue number and Project key respectively.

    select id, summary, description from jiraissue where issuenum=123 and project=(select id from project where pkey='TEST');

    Alternative query to retrieve all duplicate issuenum values for a single project using query below:

    WITH temp AS (
      SELECT ji.issuenum, CONCAT(p.pkey, '-', ji.issuenum) AS key
      FROM jiraissue ji
      JOIN project p ON p.id = ji.project
      WHERE p.pkey = '<insert project key here>'
      GROUP BY ji.issuenum, p.pkey
      HAVING COUNT(*) > 1
    )
    SELECT ji.id, t.key, ji.summary
    FROM jiraissue ji
    JOIN temp t ON t.issuenum = ji.issuenum;
  3. Choose which issue to delete and remember the ID

    The issue may be CLONE prior to the delete. This can be done by:

    1) Go to Issue Navigator, in a List View and search using issue = <issueID>

    2) Click on the "..." (three dots) on most right of the issue listed.

    3) Choose CLONE

  4. In your browser, access http://<Base URL>/secure/DeleteIssue!default.jspa?id=<id of issue>
    (info)
    Replace <id of issue> with the id of the issue you want to delete. For example, http://support.atlassian.com/secure/DeleteIssue!default.jspa?id=99999

Option 2

Change the issue number of one of the entries so they aren't duplicate

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  1. Stop Jira
  2. Generate a backup of your database
  3. Determine the issue key which is affected. In this case, it is TEST-123
  4. Run the following query against the database to determine the id and summary of the duplicate issues

    select id, summary, description from jiraissue where issuenum=<number> and project=(select id from project where pkey='<project key>');

    (info) Replace <number> and <project key> with the affected issue number and Project key respectively.

    select id, summary, description from jiraissue where issuenum=123 and project=(select id from project where pkey='TEST');

    Alternative query to retrieve all duplicate issuenum values for a single project using query below:

    WITH temp AS (
      SELECT ji.issuenum, CONCAT(p.pkey, '-', ji.issuenum) AS key
      FROM jiraissue ji
      JOIN project p ON p.id = ji.project
      WHERE p.pkey = '<insert project key here>'
      GROUP BY ji.issuenum, p.pkey
      HAVING COUNT(*) > 1
    )
    SELECT ji.id, t.key, ji.summary
    FROM jiraissue ji
    JOIN temp t ON t.issuenum = ji.issuenum;
  5. Choose which issue you wish to change the number and remember the ID
  6. Run the following query against the database to update the issuenum of the desired issue

    update jiraissue set issuenum=(select pcounter+1 from project where pkey='<project key>') where id=<id of issue>;

    (info) Replace <project key> and <id of issue> with the project key and id of the issue you want to update respectively

    update jiraissue set issuenum=(select pcounter+1 from project where pkey='TEST') where id=99999;
  7. Run the following query against the database to update the pcounter so that any new issues created will take into account this updated issue

    update project set pcounter=pcounter+1 where pkey='<project key>';

    (info) Replace <project key> the project key

    update project set pcounter=pcounter+1 where pkey='TEST';
  8. Restart Jira

  9. Run a re-index

Database queries are written for PostgreSQL. Please have your DB administrator update the queries to suit your own database.


Last modified on Mar 18, 2025

Was this helpful?

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