Duplicate key error in Jira server on creating issue via REST API or accessing Custom Fields page in JIRA

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Cloud, Server, and Data Center - This article applies equally to all platforms.


This issue might surface in various scenarios as follows (but not limited to):

Scenario 1

When checking the Required fields to create an issue in a project using a REST API below, it will return an error.

Example GET REST Call:

<JIRA Base URL>/rest/api/2/issue/createmeta?projectIds=<project id>&expand=projects.issuetypes.fields

The following error will be returned

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>Duplicate key com.atlassian.jira.rest.v2.issue.FieldMetaBean@174a0eaf</message><stack-trace>java.lang.IllegalStateException: Duplicate key com.atlassian.jira.rest.v2.issue.FieldMetaBean@174a0eaf
	at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
	at java.util.HashMap.merge(HashMap.java:1253)
	at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at com.atlassian.jira.rest.v2.issue.AbstractMetaFieldBeanBuilder.build(AbstractMetaFieldBeanBuilder.java:97)
	at com.atlassian.jira.rest.v2.issue.CreateMetaIssueTypeBean$1.expand(CreateMetaIssueTypeBean.java:31)

Scenario 2

This issue might manifest itself when accessing Custom Fields configuration page from JIRA → Settings → Custom Fields.

The exception will be slightly different in this scenario, however, the Resolution below is still applicable.

Here's an example of an exception that comes up in the logs in Scenario 2:

20-05-29 13:18:24,736 http-nio-8080-exec-7 ERROR uqpjohns 798x1632x2 1b7ddq4 X.X.X.X,X.X.X.X, /rest/api/2/customFields [c.a.j.rest.exception.ExceptionInterceptor] Returning internal server error in response
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Duplicate key com.atlassian.jira.issue.fields.screen.FieldScreenLayoutItemImpl@d8014b05


If the issue is integration related, please open the page "Logging & Profiling" on the remote application, and add the package com.atlassian.internal.integration.jira with the "DEBUG" level to let the error message parse in the server log.

Run the following SQL query towards the database to see if there is a duplicate field in a screen:

select f.name, i.fieldidentifier, count(*)
from fieldscreen f, fieldscreenlayoutitem i, fieldscreentab t
where f.id = t.fieldscreen
and i.fieldscreentab = t.id
group by f.name, i.fieldidentifier having count(*) > 1;

If there is a duplicate, an example of a result is below:

              name               | fieldidentifier | count 


 SSD: Scrum Default Issue Screen | assignee        |     2


There is a field that is appearing on a screen more than once. The cause for the duplicate is not yet known.


If there is a result shown by running the query above, it means that there is a duplicate in a screen. To remove it, follow the steps below:

  1. Navigate to JIRA Administration > Issues > Screens
  2. Look for the Screen mentioned in the SQL query result e.g. "SSD: Scrum Default Issue Screen"
  3. Click Configure and look for the field e.g. "assignee"
  4. Remove one of the fields from the screen.

In case there are multiple tabs, check for each tab whether the field is called twice.

(info) If the duplicate field is not shown on the screen or if the screen cannot be opened, the solution is to delete duplicate field reference directly from the database.

(warning) 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.

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:

    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%'
    and i.fieldidentifier='assignee';
  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):

    delete from fieldscreenlayoutitem
    where id = <duplicate_id>;
  3.  Restart Jira

DescriptionWhen checking the Required fields to create an issue in a project using a REST API below, it will return an error.


Last modified on Jun 4, 2020

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.