{"record":{"id":"de3f0ed7b51c9dc3","repo":"theonedev/onedev","slug":"duplicate-issue-field-mapping-issue-s-field-de3f0e","errorCode":null,"errorMessage":"Duplicate issue field mapping (issue: %s, field: %s)","messagePattern":"Duplicate issue field mapping \\(issue: (.+?), field: (.+?)\\)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-plugin/server-plugin-import-jiracloud/src/main/java/io/onedev/server/plugin/imports/jiracloud/ImportServer.java","lineNumber":769,"sourceCode":"\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tcomment.setUser(OneDev.getInstance(UserService.class).getUnknown());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tissue.getComments().add(comment);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\t\tissue.setCommentCount(issue.getComments().size());\n\n\t\t\t\t\t\tSet<String> fieldAndValues = new HashSet<>();\n\t\t\t\t\t\tfor (IssueField field: issue.getFields()) {\n\t\t\t\t\t\t\tString fieldAndValue = field.getName() + \"::\" + field.getValue();\n\t\t\t\t\t\t\tif (!fieldAndValues.add(fieldAndValue)) {\n\t\t\t\t\t\t\t\tString errorMessage = String.format(\n\t\t\t\t\t\t\t\t\t\t\"Duplicate issue field mapping (issue: %s, field: %s)\", \n\t\t\t\t\t\t\t\t\t\tissueKey, fieldAndValue);\n\t\t\t\t\t\t\t\tthrow new ExplicitException(errorMessage);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (!extraIssueInfo.isEmpty()) {\n\t\t\t\t\t\t\tStringBuilder builder = new StringBuilder(\"|\");\n\t\t\t\t\t\t\tfor (String key: extraIssueInfo.keySet()) \n\t\t\t\t\t\t\t\tbuilder.append(key).append(\"|\");\n\t\t\t\t\t\t\tbuilder.append(\"\\n|\");\n\t\t\t\t\t\t\textraIssueInfo.keySet().stream().forEach(it->builder.append(\"---|\"));\n\t\t\t\t\t\t\tbuilder.append(\"\\n|\");\n\t\t\t\t\t\t\tfor (String value: extraIssueInfo.values())\n\t\t\t\t\t\t\t\tbuilder.append(value).append(\"|\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif (issue.getDescription() != null)\n\t\t\t\t\t\t\t\tissue.setDescription(builder.toString() + \"\\n\\n\" + issue.getDescription());\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tissue.setDescription(builder.toString());\n\t\t\t\t\t\t}","sourceCodeStart":751,"sourceCodeEnd":787,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-jiracloud/src/main/java/io/onedev/server/plugin/imports/jiracloud/ImportServer.java#L751-L787","documentation":"The Jira Cloud counterpart of the GitLab duplicate-field check: after consuming an issue (state, type, priority, and explicit mappings all applied), consume() iterates issue.getFields() and throws this ExplicitException if two fields share the same name::value pair, since OneDev issues cannot carry duplicate field mappings.","triggerScenarios":"consume() builds fields for one issue — e.g. both the type mapping and the priority mapping (or two explicit field mappings) resolve to the same FieldSpec name with the same value — and the fieldAndValues set add returns false for issueKey.","commonSituations":"Type mapping and priority mapping both target the same OneDev field/value; duplicated rows in the issue field mappings form; a source Jira field mapped twice with identical resulting value.","solutions":["Inspect the reported issueKey and field name::value in the message; find which two mappings produce it and change one to a different field or value.","Make type, priority, and explicit field mappings write to distinct OneDev field specs so their name::value pairs cannot collide.","Remove duplicated mapping rows in the import option's issue field mappings list.","Dry-run the import first to catch duplicates across all issues before committing data."],"exampleFix":"// before: type mapping and priority mapping both produce 'Category::Bug'\ntypeMapping:    Bug    -> Category::Bug\npriorityMapping Highest -> Category::Bug\n// after\ntypeMapping:    Bug    -> Category::Bug\npriorityMapping Highest -> Importance::High","handlingStrategy":"validation","validationCode":"Set<String> targets = new HashSet<>();\nfor (IssueFieldMapping m : option.getIssueFieldMappings())\n    if (!targets.add(m.getOneDevIssueField())) throw new IllegalArgumentException(\"Duplicate mapping target: \" + m.getOneDevIssueField());","typeGuard":null,"tryCatchPattern":"try { importServer.doImport(...) } catch (ExplicitException e) { if (e.getMessage().startsWith(\"Duplicate issue field mapping\")) { /* fix colliding mappings for the reported issue */ } }","preventionTips":["Ensure type, priority, and field mappings target distinct field::value pairs.","Deduplicate mapping rows when saving the option.","Dry-run to detect collisions before the real import."],"tags":["import","jira-cloud","duplicate-field","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}