theonedev/onedev · error · ExplicitException

No field spec found:

Error message

No field spec found: 

What it means

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.

Source

Thrown at server-plugin/server-plugin-import-gitlab/src/main/java/io/onedev/server/plugin/imports/gitlab/ImportServer.java:410

			Map<String, Optional<Long>> userIds, boolean dryRun, TaskLogger logger) {
		IssueService issueService = OneDev.getInstance(IssueService.class);
		Client client = newClient();
		try {
			Set<String> nonExistentIterations = new HashSet<>();
			Set<String> nonExistentLogins = new HashSet<>();
			Set<String> unmappedIssueLabels = new HashSet<>();
			Set<String> tooLargeAttachments = new LinkedHashSet<>();
			Set<String> errorAttachments = new HashSet<>();
			
			Map<String, Pair<FieldSpec, String>> labelMappings = new HashMap<>();
			Map<String, Iteration> iterationMappings = new HashMap<>();
			
			for (IssueLabelMapping mapping: option.getIssueLabelMappings()) {
				String oneDevFieldName = StringUtils.substringBefore(mapping.getOneDevIssueField(), "::");
				String oneDevFieldValue = StringUtils.substringAfter(mapping.getOneDevIssueField(), "::");
				FieldSpec fieldSpec = getIssueSetting().getFieldSpec(oneDevFieldName);
				if (fieldSpec == null)
					throw new ExplicitException("No field spec found: " + oneDevFieldName);
				labelMappings.put(mapping.getGitLabIssueLabel(), new Pair<>(fieldSpec, oneDevFieldValue));
			}
			
			for (Iteration iteration: oneDevProject.getIterations())
				iterationMappings.put(iteration.getName(), iteration);
			
			String initialIssueState = getIssueSetting().getInitialStateSpec().getName();
				
			List<Issue> issues = new ArrayList<>();
			Map<Long, Long> issueNumberMappings = new HashMap<>();
			
			AtomicInteger numOfImportedIssues = new AtomicInteger(0);
			PageDataConsumer pageDataConsumer = new PageDataConsumer() {

				@Nullable
				private String processAttachments(String issueUUID, String issueFQN, String markdown, 
						String attachmentRootUrl, Set<String> tooLargeAttachments) {
				    StringBuffer buffer = new StringBuffer();  

View on GitHub (pinned to d44925c47c)

Solutions

  1. Check the project's Issue Settings for the exact field spec name
  2. Correct the oneDevIssueField value in the import option (name::value format)
  3. Add the missing custom field to Issue Settings if required
  4. Retry the import once mappings are fixed

Example fix

// before
new IssueLabelMapping("priority::high", "Priority::High") // field 'Priority' missing
// after: create field 'Priority' in Issue Settings, or map to existing field
new IssueLabelMapping("priority::high", "Type::Task")
Defensive patterns

Strategy: validation

Validate before calling

for (var m : option.getIssueLabelMappings()) {
    String name = StringUtils.substringBefore(m.getOneDevIssueField(), "::");
    boolean found = getIssueSetting().getFieldSpecs().stream()
        .anyMatch(f -> f.getName().equals(name));
    if (!found) throw new IllegalArgumentException("Field not in Issue Settings: " + name);
}

Try / catch

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; }

Prevention

When it happens

Trigger: importIssues called with an IssueLabelMapping whose oneDevIssueField prefix (before '::') does not match any field spec in the target project's issue settings.

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/da82371f81ba0657. Report an issue: GitHub.