{"record":{"id":"2436406285db075d","repo":"theonedev/onedev","slug":"duplicate-issue-field-mapping-issue-s-field-243640","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-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java","lineNumber":414,"sourceCode":"\t\t\t\t\t\t\t\ttagField.setOrdinal(mapped.getLeft().getOrdinal(mapped.getRight()));\n\t\t\t\t\t\t\t\tissue.getFields().add(tagField);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcurrentUnmappedLabels.add(labelName);\n\t\t\t\t\t\t\t\tunmappedIssueLabels.add(HtmlEscape.escapeHtml5(labelName));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!currentUnmappedLabels.isEmpty()) \n\t\t\t\t\t\t\textraIssueInfo.put(\"Labels\", joinAsMultilineHtml(currentUnmappedLabels));\n\t\t\t\t\t\t\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\tgitHubRepo + \"#\" + oldNumber, 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":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java#L396-L432","documentation":"During GitHub issue import, each imported issue's field mappings (name::value pairs) are deduplicated via a set; a repeated identical pair means two labels/mappings resolve to the same field value for that issue, so consume throws this ExplicitException to prevent ambiguous duplicate assignments.","triggerScenarios":"Importing an issue whose GitHub labels hit two IssueLabelMappings producing the same oneDev field name and value, or duplicate mappings in the import option for repo gitHubRepo#oldNumber.","commonSituations":"An issue tagged with two labels that both map to the same field::value; misconfigured mapping list with repeated entries; label plus default field assignment colliding.","solutions":["Deduplicate IssueLabelMappings in the import option so no two labels map to the same field::value","Inspect the reported issue's labels and remove one of the colliding labels in GitHub or exclude it via mapping","Use distinct field values per label (e.g. Type::Bug vs Type::Task)","Re-run the import after cleaning up"],"exampleFix":"// before: issue has labels 'bug' and 'critical' both mapped\nbug      -> Type::Bug\ncritical -> Type::Bug  // duplicate\n// after\ncritical -> Priority::High","handlingStrategy":"validation","validationCode":"Set<String> targets = new HashSet<>();\nfor (var m : importOption.getIssueLabelMappings()) {\n    if (!targets.add(m.getOneDevIssueField()))\n    throw new IllegalArgumentException(\"Two labels map to same field: \" + m.getOneDevIssueField());\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { if (e.getMessage().contains(\"Duplicate issue field mapping\")) { /* adjust mappings/labels, re-run */ } else throw e; }","preventionTips":["Ensure no two GitHub labels map to the same field::value","Audit issue labels that combine to duplicate mappings","Keep the mapping list deduplicated before running the import"],"tags":["github","import","issues","duplicate"],"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"}