CreateIssueMeta returns Duplicate Key error

Still need help?

The Atlassian Community is here for you.

Ask the community

This Knowledge Base article applies equally to both the Atlassian Server and Atlassian Cloud platforms.

Problem

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)
	...
</stack-trace></status>

Diagnosis

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

Cause

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

Resolution

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.



Description When checking the Required fields to create an issue in a project using a REST API below, it will return an error.
Product Jira
Platform Server
Last modified on Oct 12, 2018

Was this helpful?

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