{"record":{"id":"9a9dd1bec2cf8aea","repo":"theonedev/onedev","slug":"no-field-spec-found-9a9dd1","errorCode":null,"errorMessage":"No field spec found: ","messagePattern":"No field spec found: ","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":330,"sourceCode":"\t\t\tMap<Long, Long> issueNumberMappings = new HashMap<>();\n\t\t\tMap<String, Issue> issueMapping = new HashMap<>();\n\n\t\t\tfor (IssueStateMapping mapping : option.getIssueStateMappings())\n\t\t\t\tstateMappings.put(mapping.getYouTrackIssueState(), mapping.getOneDevIssueState());\n\n\t\t\tfor (IssueFieldMapping mapping : option.getIssueFieldMappings()) {\n\t\t\t\tString oneDevFieldName;\n\t\t\t\tString oneDevFieldValue;\n\t\t\t\tif (mapping.getOneDevIssueField().contains(\"::\")) {\n\t\t\t\t\toneDevFieldName = StringUtils.substringBefore(mapping.getOneDevIssueField(), \"::\");\n\t\t\t\t\toneDevFieldValue = StringUtils.substringAfter(mapping.getOneDevIssueField(), \"::\");\n\t\t\t\t} else {\n\t\t\t\t\toneDevFieldName = mapping.getOneDevIssueField();\n\t\t\t\t\toneDevFieldValue = null;\n\t\t\t\t}\n\t\t\t\tFieldSpec fieldSpec = getIssueSetting().getFieldSpec(oneDevFieldName);\n\t\t\t\tif (fieldSpec == null)\n\t\t\t\t\tthrow new ExplicitException(\"No field spec found: \" + oneDevFieldName);\n\t\t\t\tfieldMappings.put(mapping.getYouTrackIssueField(), new Pair<>(fieldSpec, oneDevFieldValue));\n\t\t\t}\n\t\t\tfor (IssueTagMapping mapping : option.getIssueTagMappings()) {\n\t\t\t\tString oneDevFieldName = StringUtils.substringBefore(mapping.getOneDevIssueField(), \"::\");\n\t\t\t\tString oneDevFieldValue = StringUtils.substringAfter(mapping.getOneDevIssueField(), \"::\");\n\t\t\t\tFieldSpec fieldSpec = getIssueSetting().getFieldSpec(oneDevFieldName);\n\t\t\t\tif (fieldSpec == null)\n\t\t\t\t\tthrow new ExplicitException(\"No field spec found: \" + oneDevFieldName);\n\t\t\t\ttagMappings.put(mapping.getYouTrackIssueTag(), new Pair<>(fieldSpec, oneDevFieldValue));\n\t\t\t}\n\t\t\tfor (IssueLinkMapping mapping : option.getIssueLinkMappings()) {\n\t\t\t\tLinkSpec linkSpec = OneDev.getInstance(LinkSpecService.class).find(mapping.getOneDevIssueLink());\n\t\t\t\tif (linkSpec == null)\n\t\t\t\t\tthrow new ExplicitException(\"No link spec found: \" + mapping.getOneDevIssueLink());\n\t\t\t\tlinkMappings.put(mapping.getYouTrackIssueLink(), linkSpec);\n\t\t\t}\n\n\t\t\tSet<String> nonExistentLogins = new LinkedHashSet<>();","sourceCodeStart":312,"sourceCodeEnd":348,"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#L312-L348","documentation":"Thrown during YouTrack issue import while resolving field mappings: each mapping names a OneDev issue field, and getIssueSetting().getFieldSpec() returned null because no such field spec exists in the target project's issue settings. The importer refuses to import issues with a mapping pointing at a nonexistent OneDev field.","triggerScenarios":"An IssueFieldMapping's oneDevIssueField refers to a custom field (e.g. \"State\", \"Priority\", or a custom field name) that was deleted or renamed in the OneDev project's issue settings before running the import; or the settings were hand-edited with an invalid field name.","commonSituations":"Custom field removed after the import option was generated; project changed; copying import settings between projects with different issue field configurations; typo in field name.","solutions":["Re-generate the import option so field mappings match current OneDev issue settings.","Add/recreate the missing custom field in the project's Issue Settings.","Edit the mapping to point at an existing OneDev issue field.","Remove mappings for fields you do not want imported."],"exampleFix":"// before: mapping to deleted field\nissueFieldMappings: [{youTrackIssueField: \"Stage\", oneDevIssueField: \"Milestone::v1\"}]\n\n// after: field recreated in OneDev settings, or mapped to existing field\nissueFieldMappings: [{youTrackIssueField: \"Stage\", oneDevIssueField: \"Iteration::v1\"}]","handlingStrategy":"validation","validationCode":"// verify mapped fields exist in target project issue settings\nIssueSetting setting = project.getIssueSetting();\nfor (IssueFieldMapping m : option.getIssueFieldMappings()) {\n    if (setting.getFieldSpec(m.getOneDevIssueField()) == null)\n        throw new IllegalStateException(\"Mapped OneDev field missing: \" + m.getOneDevIssueField());\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { logger.error(\"Field mapping invalid: {}\", e.getMessage()); }","preventionTips":["Do not delete or rename OneDev custom fields referenced by pending imports.","Re-generate the import option after changing issue settings.","Avoid copying import settings between projects with different field configs."],"tags":["youtrack","import","field-mapping","configuration"],"backgroundTag":"resource-not-found","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"}