{"record":{"id":"1e59ad186e2294c2","repo":"theonedev/onedev","slug":"duplicate-issue-field-mapping-issue-s-field-1e59ad","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-youtrack/src/main/java/io/onedev/server/plugin/imports/youtrack/ImportServer.java","lineNumber":966,"sourceCode":"\t\t\t\t\t\t\t\t\t\tnonExistentLogins.add(login);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tissue.setSubmitter(SecurityUtils.getAuthUser());\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\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\treadableId, 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\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\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":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-plugin/server-plugin-import-youtrack/src/main/java/io/onedev/server/plugin/imports/youtrack/ImportServer.java#L948-L984","documentation":"Thrown while consuming a YouTrack issue: the importer collects each issue field as name::value and requires uniqueness; if the same field name and value appears twice on one YouTrack issue, the generated OneDev field mapping would be ambiguous, so it aborts with this ExplicitException naming the issue and duplicated field::value.","triggerScenarios":"A YouTrack issue carries two fields with identical name and value (possible after YouTrack project merges, duplicate custom fields attached to the same project, or a field appearing both project-level and issue-level), and the consumer thread processes that issue.","commonSituations":"YouTrack custom field added to a project twice (e.g. 'Priority' as both project and regular field); issues moved between projects retaining stale field duplicates; YouTrack data corruption after migration.","solutions":["Fix the source YouTrack issue by removing the duplicated custom field on the project or issue.","Check the YouTrack project's custom field configuration for duplicated field attachments and remove one.","Delete/merge the affected YouTrack issue duplicates before importing.","Re-run the import after cleaning the YouTrack data."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// detect duplicate field name::value on the YouTrack issue before import\nSet<String> seen = new HashSet<>();\nfor (IssueField f : issue.getFields()) {\n    if (!seen.add(f.getName() + \"::\" + f.getValue()))\n        logger.warn(\"Issue {} has duplicate field {}::{}\", issue.getIdReadable(), f.getName(), f.getValue());\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { logger.error(\"Duplicate YouTrack field on issue: {}\", e.getMessage()); }","preventionTips":["Audit YouTrack projects for custom fields attached more than once.","Clean up issues moved between projects that retained duplicate fields.","Fix source data in YouTrack before starting the import."],"tags":["youtrack","import","field-mapping","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-14T00:17:10.932Z"}