Jira throws "Caused by: java.lang.IllegalArgumentException: Passed List had more than one value" when viewing an issue
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
When viewing an issue, Jira will throw a 500 error.
The following appears in the atlassian-jira.log
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
The project column contains the id of the project an issue is in
The issuenum column contains the number of an issue
Having the same values for these 2 columns for different entries in the
jiraissue
table means there are 2 different issues with the same issue key (in this case is TEST-123)If this behavior surfaced after a CSV import, its root cause might be related to the following bug report: JRASERVER-64802 - CSV import changes project of moved issues back to the original creating duplicate issues and IllegalArgumentException. Please make sure to confirm you're not affected by it before following the steps below.
Resolution
There are several options to resolve this
Option 1
Remove one of the entries via the JIra UI
Determine the issue key which is affected. In this case, it is TEST-123
Run the following query against the database to determine the id and summary of the duplicate issues
1
select id, summary, description from jiraissue where issuenum=<number> and project=(select id from project where pkey='<project key>');
ℹ️ Replace <number> and <project key> with the affected issue number and Project key respectively.
1
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:
1 2 3 4 5 6 7 8 9 10 11
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;
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
In your browser, access http://<Base URL>/secure/DeleteIssue!default.jspa?id=<id of issue>
ℹ️ 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 making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Stop Jira
Generate a backup of your database
Determine the issue key which is affected. In this case, it is TEST-123
Run the following query against the database to determine the id and summary of the duplicate issues
1
select id, summary, description from jiraissue where issuenum=<number> and project=(select id from project where pkey='<project key>');
ℹ️ Replace <number> and <project key> with the affected issue number and Project key respectively.
1
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:
1 2 3 4 5 6 7 8 9 10 11
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;
Choose which issue you wish to change the number and remember the ID
Run the following query against the database to update the issuenum of the desired issue
1
update jiraissue set issuenum=(select pcounter+1 from project where pkey='<project key>') where id=<id of issue>;
ℹ️ Replace <project key> and <id of issue> with the project key and id of the issue you want to update respectively
1
update jiraissue set issuenum=(select pcounter+1 from project where pkey='TEST') where id=99999;
Run the following query against the database to update the pcounter so that any new issues created will take into account this updated issue
1
update project set pcounter=pcounter+1 where pkey='<project key>';
ℹ️ Replace <project key> the project key
1
update project set pcounter=pcounter+1 where pkey='TEST';
Restart Jira
Run a re-index
Database queries are written for PostgreSQL. Please have your DB administrator update the queries to suit your own database.
Was this helpful?