Upgrading to JIRA 6.1 Fails Due To Duplicate Project Keys

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

Symptoms

When upgrading to JIRA 6.1 or later process stops and the following appears in the atlassian-jira.log:

1 2 3 INFO [atlassian.jira.upgrade.UpgradeManagerImpl] Performing Upgrade Task: Create table tracking historical Project keys ... ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ProjectKey]... (SQL Exception while executing the following:INSERT INTO PUBLIC.project_key (ID, PROJECT_ID, PROJECT_KEY) VALUES (?, ?, ?) (Violation of unique index: IDX_ALL_PROJECT_KEYS in statement [INSERT INTO PUBLIC.project_key (ID, PROJECT_ID, PROJECT_KEY) VALUES (?, ?, ?)]))

Cause

There is more than one project in PROJECT table with the same project key. Following sql will return list of offending project keys.

1 SELECT pkey, COUNT(*) FROM project GROUP BY pkey HAVING COUNT(*) > 1;

Resolution

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.

  1. Find offending projects. You can use following sql to find those projects. Replace TEST with duplicated project key.

    1 SELECT * FROM project WHERE pkey = 'TEST';
  2. Resolve key conflicts. You can either remove unused project or change one of project keys.

  3. Repeat steps 2-3 for all duplicated keys.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.