{"record":{"id":"ab06b0d312cc8da7","repo":"theonedev/onedev","slug":"duplicate-issue-field-mapping-issue-s-field","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-gitea/src/main/java/io/onedev/server/plugin/imports/gitea/ImportServer.java","lineNumber":440,"sourceCode":"\t\t\t\t\t\t\t\t\tcomment.setUser(userService.load(userId));\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcomment.setUser(OneDev.getInstance(UserService.class).getUnknown());\n\t\t\t\t\t\t\t\t\tnonExistentLogins.add(userNode.get(\"username\").asText());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tissue.getComments().add(comment);\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":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-gitea/src/main/java/io/onedev/server/plugin/imports/gitea/ImportServer.java#L422-L458","documentation":"During Gitea issue import, each imported issue's field mappings (name::value pairs) are collected into a set; if the same field name+value appears twice for one issue the import is aborted with this ExplicitException to avoid ambiguous duplicate custom-field assignments.","triggerScenarios":"Calling importIssues (consume callback) when a Gitea issue maps two labels to the same OneDev field/value combination, or a mapping plus issue data produces the identical field name and value twice.","commonSituations":"Configuring two different Gitea labels to map to the same OneDev issue field value; an issue having two labels that collapse to the same field mapping; repeated import option entries.","solutions":["Review Issue Label Mappings in the import option and remove/merge entries that map different labels to the same field::value","Check the specific issue (named in the message) for duplicate labels that resolve to the same mapping","Deduplicate fields before import if custom preprocessing is used","Re-run the import after fixing the mappings"],"exampleFix":"// before: two mappings\nbug    -> Type::Bug\nissue  -> Type::Bug  // duplicate for issues with both labels\n// after: single mapping or distinct values\nbug    -> Type::Bug\nissue  -> Type::Task","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (var m : importOption.getIssueLabelMappings()) {\n    if (!seen.add(m.getOneDevIssueField()))\n        throw new IllegalArgumentException(\"Duplicate mapping: \" + m.getOneDevIssueField());\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { if (e.getMessage().startsWith(\"Duplicate issue field mapping\")) { /* fix mappings and retry */ } else throw e; }","preventionTips":["Keep label-to-field mappings one-to-one (one label -> one distinct field::value)","Review mapping list for repeated targets before importing","Check source issues for label combinations that collapse to the same mapping"],"tags":["gitea","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"}