{"record":{"id":"a345272ab8b73d9a","repo":"theonedev/onedev","slug":"no-field-spec-found","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-github/src/main/java/io/onedev/server/plugin/imports/github/ImportServer.java","lineNumber":253,"sourceCode":"\t\n\tImportResult importIssues(String gitHubRepo, Project oneDevProject, IssueImportOption importOption, \n\t\t\tMap<String, Optional<Long>> userIds, boolean dryRun, TaskLogger logger) {\n\t\tClient client = newClient();\n\t\tIssueService issueService = OneDev.getInstance(IssueService.class);\n\t\ttry {\n\t\t\tSet<String> nonExistentIterations = new HashSet<>();\n\t\t\tSet<String> nonExistentLogins = new HashSet<>();\n\t\t\tSet<String> unmappedIssueLabels = new HashSet<>();\n\t\t\t\n\t\t\tMap<String, Pair<FieldSpec, String>> labelMappings = new HashMap<>();\n\t\t\tMap<String, Iteration> iterationMappings = new HashMap<>();\n\t\t\t\n\t\t\tfor (IssueLabelMapping mapping: importOption.getIssueLabelMappings()) {\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\tlabelMappings.put(mapping.getGitHubIssueLabel(), new Pair<>(fieldSpec, oneDevFieldValue));\n\t\t\t}\n\t\t\t\n\t\t\tfor (Iteration iteration: oneDevProject.getIterations())\n\t\t\t\titerationMappings.put(iteration.getName(), iteration);\n\t\t\t\n\t\t\tString initialIssueState = getIssueSetting().getInitialStateSpec().getName();\n\t\t\t\t\n\t\t\tList<Issue> issues = new ArrayList<>();\n\t\t\t\n\t\t\tMap<Long, Long> issueNumberMappings = new HashMap<>();\n\t\t\t\n\t\t\tAtomicInteger numOfImportedIssues = new AtomicInteger(0);\n\t\t\tPageDataConsumer pageDataConsumer = new PageDataConsumer() {\n\n\t\t\t\tprivate String joinAsMultilineHtml(List<String> values) {\n\t\t\t\t\tList<String> escapedValues = new ArrayList<>();\n\t\t\t\t\tfor (String value: values)","sourceCodeStart":235,"sourceCodeEnd":271,"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#L235-L271","documentation":"GitHub issue import maps GitHub labels to OneDev issue fields. For each mapping the configured OneDev field name is looked up in the project's issue setting; if no FieldSpec with that name exists, importIssues aborts with this ExplicitException naming the missing field.","triggerScenarios":"Running importIssues with an IssueLabelMapping whose oneDevIssueField (part before '::') does not match any field spec defined in the target project's issue settings.","commonSituations":"Typo in the field name in the import option; field was deleted or renamed in OneDev after the mapping was saved; copying import options between projects with different custom fields.","solutions":["Open the project's Issue Settings and verify the exact field name exists","Fix the oneDevIssueField value in the import option to match the field spec name (including the '::value' suffix)","Create the missing custom field in Issue Settings if it is genuinely needed","Re-run the import after correcting the mapping"],"exampleFix":"// before\nnew IssueLabelMapping(\"bug\", \"Bug Type::Defect\")   // no field 'Bug Type'\n// after (field is named 'Type')\nnew IssueLabelMapping(\"bug\", \"Type::Defect\")","handlingStrategy":"validation","validationCode":"var fieldSpecs = getIssueSetting().getFieldSpecs();\nfor (IssueLabelMapping m : importOption.getIssueLabelMappings()) {\n    String name = StringUtils.substringBefore(m.getOneDevIssueField(), \"::\");\n    if (fieldSpecs.stream().noneMatch(f -> f.getName().equals(name)))\n        throw new IllegalArgumentException(\"Unknown OneDev field in mapping: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { if (e.getMessage().startsWith(\"No field spec found\")) { /* create/fix field then retry */ } else throw e; }","preventionTips":["Verify field names in Issue Settings match mapping strings exactly","Re-validate saved import options after renaming/removing custom fields","Copy import options only between projects with identical field sets"],"tags":["github","import","issues","field-mapping"],"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"}