{"record":{"id":"447551bca96bab9e","repo":"theonedev/onedev","slug":"duplicate-issue-field-mapping-issue-s-field-447551","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-gitlab/src/main/java/io/onedev/server/plugin/imports/gitlab/ImportServer.java","lineNumber":683,"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\tnonExistentLogins.add(authorNode.get(\"username\").asText());\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\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\tissueFQN, 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":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-gitlab/src/main/java/io/onedev/server/plugin/imports/gitlab/ImportServer.java#L665-L701","documentation":"This ExplicitException is thrown by the GitLab issue import consumer in server-plugin-import-gitlab when, after all field mappings are built for a single issue, two or more IssueField entries resolve to the same name::value pair. OneDev requires every custom field on an imported issue to be unique, so a duplicate mapping would be silently dropped or corrupted downstream; the import aborts with an explicit, user-facing message instead.","triggerScenarios":"Running a GitLab import whose issue field mappings produce two fields with identical name and value for the same issue — e.g. two IssueFieldMapping rows pointing at the same OneDev field, or a mapping that yields the same name::value as a type/priority/state-derived field. Detected inside consume() while iterating issue.getFields() into a fieldAndValues set.","commonSituations":"Config where several source fields map to the same OneDev custom field name with the same value; copy-pasted duplicate mapping entries in the import option form; an issue whose imported state/priority fields collide with an explicitly mapped field using the same name and value.","solutions":["Open the import option's issue field mappings in the GitLab import form and remove entries that duplicate another mapping's OneDev field name and value.","If two source fields intentionally map to one OneDev field, merge them into a single mapping or map them to distinct OneDev fields so name::value pairs are unique.","Re-run the import (optionally with dry run first); the message names the offending issue and field pair, then adjust only those mappings.","If the duplicate comes from auto-derived fields (state/type/priority), change the explicit field mapping to a different field name so it no longer collides."],"exampleFix":"// before: two mappings both resolve to 'Severity::High'\nmapping1: sourceField=labels   -> oneDevIssueField=Severity::High\nmapping2: sourceField=priority -> oneDevIssueField=Severity::High\n// after\nmapping1: sourceField=labels   -> oneDevIssueField=Severity::High\nmapping2: sourceField=priority -> oneDevIssueField=PriorityLabel::High","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (IssueField f : issue.getFields()) {\n    if (!seen.add(f.getName() + \"::\" + f.getValue()))\n        throw new IllegalArgumentException(\"Duplicate field: \" + f.getName());\n}","typeGuard":null,"tryCatchPattern":"try { importServer.doImport(...) } catch (ExplicitException e) { if (e.getMessage().startsWith(\"Duplicate issue field mapping\")) { /* fix mappings in import option */ } else throw e; }","preventionTips":["Keep type/priority/state mappings writing to distinct field specs from explicit field mappings.","Deduplicate the mappings list before saving the import option.","Dry-run imports before the real run."],"tags":["import","gitlab","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-14T00:17:10.932Z"}