Cannot enable a X-ray add-on after Jira upgrade due to duplicate key errors

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 rare cases, after upgrading Jira to version 9.x, some X-ray add-ons (such as Xray Test Management for Jira) might fail to startup after the upgrade. It will also not be possible to enable it (or them) even via the ⚙ > Manage Apps > Manage Apps page.

Environment

Jira Data Center upgraded to version 9.x and above.

Diagnosis

Check the log file <Jira_home>/logatlassian-jira.log for presence of the following exception:

1 2 2023-04-30 01:03:51,203+0000 http-nio-8080-exec-85 ERROR user.name 63x3681x1 1u0drph 100.79.49.122,100.79.49.243 /rest/plugins/1.0/com.xpandit.plugins.xray-key [c.xpandit.raven.RavenSetupHandler] Xray add-on initialization failed! Disabling Xray add-on... com.atlassian.jira.exception.CreateException: java.lang.IllegalStateException: Duplicate key customfield_33300 (attempted merging values com.atlassian.jira.issue.fields.screen.FieldScreenLayoutItemImpl@812ea9e8 and com.atlassian.jira.issue.fields.screen.FieldScreenLayoutItemImpl@812e9eeb)

Cause

Duplicate values in Field Screen layouts. While such values shouldn't be preventing add-ons from starting up, we have a similar issue documented in the KB article below, whereby Jira would fail to create issues via REST APIs or access custom fields page:

Solution

In the first instance we'd recommend reaching out to the add-on vendor for guidance on how to resolve the issue.

If the issue is very urgent, please follow the steps from the linked article, i.e. identify the affected field layout scheme first, then delete the duplicate values via the User Interface if possible, if still not possible, follow the DB update steps, i.e.:

Through the Database

If the duplicate field is not shown on the screen or if the screen cannot be opened _(error message or endless loading spinner)_, the solution is to delete duplicate field reference directly from the database.

Please back up your database before proceeding with this workaround. Also, if possible, test the workaround on a staging environment before applying it on production.

To resolve specific duplicate records, the steps are as follows:

  1. Identify and write down ID value for each duplicate field reference; screen name and field identifier need to be modified accordingly. For the current example, the ID can be identified as follows:

    1 2 3 4 5 select f.name, i.id, i.fieldidentifier from fieldscreen f, fieldscreenlayoutitem i, fieldscreentab t where f.id = t.fieldscreen and i.fieldscreentab = t.id and f.name like '%SSD: Scrum Default Issue Screen%' -- the affected screen name from the diagnosis query and i.fieldidentifier='assignee'; -- the affected customfield from the diagnosis query
  2. Delete all duplicate rows from fieldscreenlayoutitem table and retain only one row; replace <duplicate_id> with the ID that you wrote down in previous step (in this example, there is only one duplicate row that needs to be deleted):

    1 2 delete from fieldscreenlayoutitem where id = <duplicate_id>;
  3. Restart Jira (For Jira Data Center on a cluster of nodes, a rolling restart of the nodes will suffice)

Updated on March 14, 2025

Still need help?

The Atlassian Community is here for you.