Issue with specific projects while bulk edit via CSV import in Jira.

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

In this article we are going to discuss a scenario in which a bulk update of a specific project in Jira via CSV import can fail and throw exception due to duplicate project components, as shown in the log snippet below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 2022-03-03 08:58:08,130 INFO - Import started by SAMPLE using com.atlassian.jira.plugins.importer.imports.csv.CsvDataBean 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Importing: Users 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Only new items will be imported 2022-03-03 08:58:08,131 INFO - 0 users associated with import. All of them imported as inactive, this can be changed after import in User Access step. 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Finished Importing : Users 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - 0 users successfully created. 2022-03-03 08:58:08,131 INFO - Retrieving projects... 2022-03-03 08:58:08,131 INFO - Project ExternalProject{id='null', key='SAMPLEPROJECTKEY', externalName='null', name='SAMPLE PROJECT'} exists and found correctly. 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Importing: Versions 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Only new items will be imported 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Finished Importing : Versions 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Importing: Components 2022-03-03 08:58:08,131 INFO - ------------------------------ 2022-03-03 08:58:08,131 INFO - Only new items will be imported 2022-03-03 08:58:08,132 ERROR - Unexpected failure occurred. Importer will stop immediately. Data may be in an unstable state java.lang.IllegalArgumentException: Multiple entries with same key: SAMPLE - PH=ProjectComponentImpl { name='SAMPLE - PH', description='', lead='', assigneeType='3', projectId='10000', id='10010', archived='false' } and SAMPLE - PH=ProjectComponentImpl { name='SAMPLE - PH', description='', lead='', assigneeType='0', projectId='10000', id='10011', archived='false' }. To index multiple values under a key, use Multimaps.index. at com.google.common.collect.Maps.uniqueIndex(Maps.java:1341) at com.google.common.collect.Maps.uniqueIndex(Maps.java:1296) at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.getProjectComponents(DefaultJiraDataImporter.java:1518) at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.importComponents(DefaultJiraDataImporter.java:725) at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.doImport(DefaultJiraDataImporter.java:375) at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:26) at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:15) at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:533) at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:491) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:2 16) at java.base/java.lang.Thread.run(Thread.java:829) 2022-03-03 08:58:08,132 INFO - No issues need to be reindexed.

Environment

Jira 8.x and later

Diagnosis

Check the response to the following REST call sent to the Jira application (make sure to replace <username> and <password> with the credentials of a Jira admin user, and <JIRA_BASE_URL> with the Jira Base URL):

1 curl -v -u "<username>:<password>" <JIRA_BASE_URL>/rest/api/2/project/[PROJECT-KEY]/components

In response to the REST call, we should see duplicate components like in the example of output below. In the example below, we can see the component 'SAMPLE - PH' twice, but the ids are different:

1 2 3 curl -u "username:password" http://localhost:8080/rest/api/2/project/PRJ1/components {"self":"http://localhost:8080/rest/api/2/component/10001","id":"10001" name='SAMPLE - PH', description='', lead='', assigneeType='3', projectId='10000', archived='false' } {"self":"http://localhost:8080/rest/api/2/component/10002","id":"10002" name='SAMPLE - PH', description='', lead='', assigneeType='3', projectId='10000', archived='false' }

Alternatively, you can run the following SQL query to check if some Jira projects have duplicate comments:

1 select project, cname, count(*) from component group by project, cname having count(*) > 1;

If you can find duplicate components using either of the method above, then this KB article is relevant and you can follow the steps from the Solution section of this article to fix the import.

Cause

As shown in the stack-trace of the error, there is a problem fetching ProjectComponents:

1 com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.getProjectComponents(DefaultJiraDataImporter.java:1518)

Project components can't be fetched, and the project is failing because it contains 2 components with the same name.

Solution

To fix the import, follow the steps below:

  • Go to the page Project Settings > Components for the project where you were trying to run the import

  • Look for the duplicate components on this page, and delete one of the 2 instances of the duplicate components

  • After the duplicate component is deleted, the import should be successful

Updated on March 3, 2025

Still need help?

The Atlassian Community is here for you.