{"record":{"id":"da82371f81ba0657","repo":"theonedev/onedev","slug":"no-field-spec-found-da8237","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-gitlab/src/main/java/io/onedev/server/plugin/imports/gitlab/ImportServer.java","lineNumber":410,"sourceCode":"\t\t\tMap<String, Optional<Long>> userIds, boolean dryRun, TaskLogger logger) {\n\t\tIssueService issueService = OneDev.getInstance(IssueService.class);\n\t\tClient client = newClient();\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\tSet<String> tooLargeAttachments = new LinkedHashSet<>();\n\t\t\tSet<String> errorAttachments = 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: option.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.getGitLabIssueLabel(), 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\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\t@Nullable\n\t\t\t\tprivate String processAttachments(String issueUUID, String issueFQN, String markdown, \n\t\t\t\t\t\tString attachmentRootUrl, Set<String> tooLargeAttachments) {\n\t\t\t\t    StringBuffer buffer = new StringBuffer();  ","sourceCodeStart":392,"sourceCodeEnd":428,"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#L392-L428","documentation":"GitLab issue import maps GitLab labels to OneDev issue fields. Each mapping's OneDev field name is resolved against the project's issue setting; if no FieldSpec with that name exists, importIssues fails fast with this ExplicitException naming the unknown field.","triggerScenarios":"importIssues called with an IssueLabelMapping whose oneDevIssueField prefix (before '::') does not match any field spec in the target project's issue settings.","commonSituations":"Field renamed or removed after mappings were configured; typos in field names; reusing import options from a different project with different custom fields; case mismatches in field names.","solutions":["Check the project's Issue Settings for the exact field spec name","Correct the oneDevIssueField value in the import option (name::value format)","Add the missing custom field to Issue Settings if required","Retry the import once mappings are fixed"],"exampleFix":"// before\nnew IssueLabelMapping(\"priority::high\", \"Priority::High\") // field 'Priority' missing\n// after: create field 'Priority' in Issue Settings, or map to existing field\nnew IssueLabelMapping(\"priority::high\", \"Type::Task\")","handlingStrategy":"validation","validationCode":"for (var m : option.getIssueLabelMappings()) {\n    String name = StringUtils.substringBefore(m.getOneDevIssueField(), \"::\");\n    boolean found = getIssueSetting().getFieldSpecs().stream()\n        .anyMatch(f -> f.getName().equals(name));\n    if (!found) throw new IllegalArgumentException(\"Field not in Issue Settings: \" + name);\n}","typeGuard":null,"tryCatchPattern":"try { importServer.importIssues(...); } catch (ExplicitException e) { if (e.getMessage().startsWith(\"No field spec found\")) { /* create the field or fix the mapping, retry */ } else throw e; }","preventionTips":["Cross-check mapping field names against Issue Settings before importing","Update mappings whenever custom fields are renamed or deleted","Avoid reusing mappings across projects with differing field definitions"],"tags":["gitlab","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"}