NOTE: This bug report is for JIRA Server. Using JIRA Cloud? See the corresponding bug report.

      While importing a project from a JIRA backup the import fails with the following error.

      The import was aborted because there were too many errors. Some errors are listed below. For full details about the errors please see your logs. Please note that some elements have been created. You may want to consult your logs to see what caused the errors, delete the project, and perform the import again.
      

      A few of the following errors can be found in the JIRA logs

      2015-01-17 15:01:50,542 ProjectImport: CreateIssueRelatedData-10 ERROR admin 901x156x1 4bmvmr 127.0.0.1 /secure/admin/ProjectImportSummary.jspa [jira.imports.project.DefaultProjectImportPersister] DataAccessException occured while trying to create Entity type 'EntityProperty' . {id=10031, entityName=IssueProperty, entityId=10115, propertyKey=request.channel.type, value="Portal", created=2015-01-08 18:51:44.178, updated=2015-01-08 18:51:44.178}
      com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"
        Detail: Key (id)=(10031) already exists.))
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:397)
      	at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.createValue(WrappingOfBizDelegator.java:219)
      	at com.atlassian.jira.imports.project.DefaultProjectImportPersister.createEntity(DefaultProjectImportPersister.java:192)
      	at com.atlassian.jira.imports.project.handler.EntityPropertiesPersisterHandler$1.run(EntityPropertiesPersisterHandler.java:63)
      	at com.atlassian.jira.util.concurrent.BoundedExecutor$1.run(BoundedExecutor.java:50)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      	at java.lang.Thread.run(Thread.java:695)
      Caused by: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][id,10031][created,2015-01-08 18:51:44.178][updated,2015-01-08 18:51:44.178][entityId,10115][value,"Portal"][propertyKey,request.channel.type][entityName,IssueProperty] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"
        Detail: Key (id)=(10031) already exists.))
      	at org.ofbiz.core.entity.GenericDAO.singleInsert(GenericDAO.java:200)
      	at org.ofbiz.core.entity.GenericDAO.insert(GenericDAO.java:165)
      	at org.ofbiz.core.entity.GenericHelperDAO.create(GenericHelperDAO.java:83)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:554)
      	at org.ofbiz.core.entity.GenericDelegator.create(GenericDelegator.java:540)
      	at org.ofbiz.core.entity.GenericValue.create(GenericValue.java:98)
      	at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.createValue(DefaultOfBizDelegator.java:392)
      	... 7 more
      

      Steps to reproduce

      1. Get a JIRA backup from an instance with at least 20 Issue entities for a single project. e.g. create 10 issues with JIRA Service Desk. Each will add 3 issue entities
        • You can verify that with the following SQL query
          select * from entity_property where entity_name = 'IssueProperty'
      2. Import the project into another JIRA instance already containing data in the entity_property for the same IDs displayed in the query above

      Expected results
      JIRA Should import the project without any problems, using the next ID available for the entity_property table

      Actual results
      JIRA aborts the import as it tries to use the same IDs to add the respective Issue properties to the entity_properties table

      Workaround
      As a workaround you can change the EntityProperty IDs directly in the entities.xml file of the backup.

      1. Find entity IDs to change for the project. Run this at source JIRA Insert your project key into this query:
        SELECT EP.id
        FROM entity_property EP, jiraissue I, project P
        WHERE EP.entity_name = 'IssueProperty' AND I.id = EP.entity_id
          AND P.id = I.project AND P.pkey = 'YOUR_PROJECT_KEY'
        ORDER BY EP.id;
        
      2. Determine the current MAX(id), run this at target JIRA:
        SELECT MAX(id) FROM entity_property
        
      3. Modify the XML backup file, replacing the entity_property IDs with sequential numbers higher than MAX(id) from the entity_property table.
        • Make sure you only modify XML nodes that begin with "<EntityProperty id=". If the entities.xml file is large you may need to use vi or another editor that can handle really big files.
      4. Complete the import
      5. Shut down the target instance
      6. Reset the sequence_value_item table for EntityProperty types, run this at target JIRA:
        UPDATE sequence_value_item SET seq_id = (SELECT MAX(id)+100 FROM entity_property) WHERE seq_name = 'EntityProperty';
        
      7. Restart the target instance

      See KB for more detailed steps and simplified option to modify the XML backup file: Project Import fails due to too many errors

            [JRASERVER-41681] Project import aborted due to too many errors

            Sabine Van Regenmortel added a comment - - edited

            The workaround works great!
            I also used this for Bitbucket entries when doing a Project Import. They did not show up for existing issues, however the application link to the Bitbucket server worked. Setting the IDs higher, made them show up.

            The log showed something like:

            // 2016-12-25 22:02:20,944 http-nio-8080-exec-16 WARN amavg 1322x155824x3 lcom8q 10.233.36.194 /rest/dev-status/1.0/issue/summary [c.a.j.p.devstatus.provider.DefaultCoordinator] Bitbucket (com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][propertyKey,99095652-723d-389f-bc35-6ba4dd9d2a69][entityName,fusion.caches.issue][created,2016-12-25 22:02:20.928][entityId,229658][id,23317][value,{"value":{"targets":{"INK-1450":[{"type":{"id":"repository"},"objects":[{"lastUpdated":"2016-10-12T09:05:22.000-0400","count":13,"commits":["a875695a0b59e5b0e4485c2dc8f9f95c6296456c","b188dc8b71e5c7f48d35f5a800b33543c7d081a0","944364cc4655bbe8375011a758b4cc5b83cb414d","89df92b58374b9ece54cf542e388ad22f4fbc47b","019a8e374734fe5040ee239231e9fbc8c8e41ec5","4506449c98fb4f2adbc5cd329e1d911abcd0108c","b42ffe037b1a59f6fe76b8f833f726c327e36f66","bdb548658ac70181a005635a43fb4a9d98f573f5","baeff782dbcc06f6fd3f6dabd836249a8c720997","a7d00a0d9dd5c45b6fe42bd2f8030b560b49bc30","5f91cf5f9cf58336abd8b342b8b13668c2100e3a","5df6621de5935020df56171b37d7810089104a16","b2c87ccf99568d0aab9172b16ca3d85a5557e71f"],"type":"git"}]},{"type":{"id":"branch"},"objects":[]},{"type":{"id":"pullrequest"},"objects":[{"lastUpdated":"2016-10-11T13:59:39.797-0400","state":"MERGED"},{"lastUpdated":"2016-09-26T11:47:42.456-0400","state":"MERGED"}]}]}}}][updated,2016-12-25 22:02:20.928] (SQL Exception while executing the following:INSERT INTO public.entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"
                  Detail: Key (id)=(23317) already exists.)))
            

            Sabine Van Regenmortel added a comment - - edited The workaround works great! I also used this for Bitbucket entries when doing a Project Import. They did not show up for existing issues, however the application link to the Bitbucket server worked. Setting the IDs higher, made them show up. The log showed something like: // 2016-12-25 22:02:20,944 http-nio-8080-exec-16 WARN amavg 1322x155824x3 lcom8q 10.233.36.194 / rest /dev-status/1.0/issue/summary [c.a.j.p.devstatus.provider.DefaultCoordinator] Bitbucket (com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:EntityProperty][propertyKey,99095652-723d-389f-bc35-6ba4dd9d2a69][entityName,fusion.caches.issue][created,2016-12-25 22:02:20.928][entityId,229658][id,23317][value,{ "value" :{ "targets" :{ "INK-1450" :[{ "type" :{ "id" : "repository" }, "objects" :[{ "lastUpdated" : "2016-10-12T09:05:22.000-0400" , "count" :13, "commits" :[ "a875695a0b59e5b0e4485c2dc8f9f95c6296456c" , "b188dc8b71e5c7f48d35f5a800b33543c7d081a0" , "944364cc4655bbe8375011a758b4cc5b83cb414d" , "89df92b58374b9ece54cf542e388ad22f4fbc47b" , "019a8e374734fe5040ee239231e9fbc8c8e41ec5" , "4506449c98fb4f2adbc5cd329e1d911abcd0108c" , "b42ffe037b1a59f6fe76b8f833f726c327e36f66" , "bdb548658ac70181a005635a43fb4a9d98f573f5" , "baeff782dbcc06f6fd3f6dabd836249a8c720997" , "a7d00a0d9dd5c45b6fe42bd2f8030b560b49bc30" , "5f91cf5f9cf58336abd8b342b8b13668c2100e3a" , "5df6621de5935020df56171b37d7810089104a16" , "b2c87ccf99568d0aab9172b16ca3d85a5557e71f" ], "type" : "git" }]},{ "type" :{ "id" : "branch" }, "objects" :[]},{ "type" :{ "id" : "pullrequest" }, "objects" :[{ "lastUpdated" : "2016-10-11T13:59:39.797-0400" , "state" : "MERGED" },{ "lastUpdated" : "2016-09-26T11:47:42.456-0400" , "state" : "MERGED" }]}]}}}][updated,2016-12-25 22:02:20.928] (SQL Exception while executing the following:INSERT INTO public .entity_property (ID, ENTITY_NAME, ENTITY_ID, PROPERTY_KEY, CREATED, UPDATED, json_value) VALUES (?, ?, ?, ?, ?, ?, ?) (ERROR: duplicate key value violates unique constraint "pk_entity_property"       Detail: Key (id)=(23317) already exists.)))

            The workaround is in this issue's description field tommoore

            Regards,

            Oswaldo Hernández.
            JIRA Bugmaster.
            [Atlassian].

            Oswaldo Hernandez (Inactive) added a comment - The workaround is in this issue's description field tommoore Regards, Oswaldo Hernández. JIRA Bugmaster. [Atlassian] .

            Tom Moore added a comment -

            What is the workaround again please?

            Tom Moore added a comment - What is the workaround again please?

            I already have confirmed the problem with the support team, who provided me with link to this issue and the workaround (which fixed the problem). I have asked them to reopen this issue.

            Susanne Nordholm added a comment - I already have confirmed the problem with the support team, who provided me with link to this issue and the workaround (which fixed the problem). I have asked them to reopen this issue.

            Hi susanne.nordholm,

            That must be a new/similar case.

            Could you please create a support ticket at https://support.atlassian.com? That way we can provide you with support specific to your circumstances and keep your confidential information restricted to just you and our support team. The credentials should be the same as for this site (https://jira.atlassian.com).

            Once the problem is investigated by our friendly support team, we will try to fix it.

            Regards,
            Jacek Jaroczynski
            JIRA Bugmaster
            [Atlassian]

            Jacek Jaroczynski (Inactive) added a comment - Hi susanne.nordholm , That must be a new/similar case. Could you please create a support ticket at https://support.atlassian.com ? That way we can provide you with support specific to your circumstances and keep your confidential information restricted to just you and our support team. The credentials should be the same as for this site ( https://jira.atlassian.com ). Once the problem is investigated by our friendly support team, we will try to fix it. Regards, Jacek Jaroczynski JIRA Bugmaster [Atlassian]

            This issue has resurfaced on version 7.1.9 Server.

            Susanne Nordholm added a comment - This issue has resurfaced on version 7.1.9 Server.

            Hi nabil.assi,

            That is surprising as the code changes done for this fix shipped with 7.1.7. At first sight, it looks like you might be facing another issue with similar symptoms.

            Consequently, could you please create a support ticket at https://support.atlassian.com so we can investigate this in more detail with you? . The credentials should be the same as for this site (https://jira.atlassian.com).

            Regards,

            Oswaldo Hernández.
            JIRA Bugmaster.
            [Atlassian].

            Oswaldo Hernandez (Inactive) added a comment - - edited Hi nabil.assi , That is surprising as the code changes done for this fix shipped with 7.1.7. At first sight, it looks like you might be facing another issue with similar symptoms. Consequently, could you please create a support ticket at https://support.atlassian.com so we can investigate this in more detail with you? . The credentials should be the same as for this site ( https://jira.atlassian.com ). Regards, Oswaldo Hernández. JIRA Bugmaster. [Atlassian] .

            Nabil Assi added a comment -

            I have updated to JIRA 7.1.8 and still having this issue.

            Nabil Assi added a comment - I have updated to JIRA 7.1.8 and still having this issue.

            it@apexcapitalcorp.com,

            The issue has been fixed and released in JIRA 7.1.7 some time ago. We also decided to make another release of JIRA 6.4 with this fix (hence new fix version).

            6.4.14 has not been released yet but it should appear in couple of weeks.

            Cheers,
            Jacek Jaroczynski
            Bugmaster
            [Atlassian]

            Jacek Jaroczynski (Inactive) added a comment - it@apexcapitalcorp.com , The issue has been fixed and released in JIRA 7.1.7 some time ago. We also decided to make another release of JIRA 6.4 with this fix (hence new fix version). 6.4.14 has not been released yet but it should appear in couple of weeks. Cheers, Jacek Jaroczynski Bugmaster [Atlassian]

            Apex-Test added a comment -

            This issue shows to be resolved by 6.4.14, but I am unable to find the download. Has it been published yet?

            Apex-Test added a comment - This issue shows to be resolved by 6.4.14, but I am unable to find the download. Has it been published yet?

              ajakubowski Adam Jakubowski (Inactive)
              malmeida Marcus Silveira
              Affected customers:
              53 This affects my team
              Watchers:
              55 Start watching this issue

                Created:
                Updated:
                Resolved: