theonedev/onedev · error · ExplicitException

No field spec found:

Error message

No field spec found: 

What it means

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.

Source

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

			Map<Long, Long> issueNumberMappings = new HashMap<>();
			Map<String, Issue> issueMapping = new HashMap<>();

			for (IssueStateMapping mapping : option.getIssueStateMappings())
				stateMappings.put(mapping.getYouTrackIssueState(), mapping.getOneDevIssueState());

			for (IssueFieldMapping mapping : option.getIssueFieldMappings()) {
				String oneDevFieldName;
				String oneDevFieldValue;
				if (mapping.getOneDevIssueField().contains("::")) {
					oneDevFieldName = StringUtils.substringBefore(mapping.getOneDevIssueField(), "::");
					oneDevFieldValue = StringUtils.substringAfter(mapping.getOneDevIssueField(), "::");
				} else {
					oneDevFieldName = mapping.getOneDevIssueField();
					oneDevFieldValue = null;
				}
				FieldSpec fieldSpec = getIssueSetting().getFieldSpec(oneDevFieldName);
				if (fieldSpec == null)
					throw new ExplicitException("No field spec found: " + oneDevFieldName);
				fieldMappings.put(mapping.getYouTrackIssueField(), new Pair<>(fieldSpec, oneDevFieldValue));
			}
			for (IssueTagMapping mapping : option.getIssueTagMappings()) {
				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);
				tagMappings.put(mapping.getYouTrackIssueTag(), new Pair<>(fieldSpec, oneDevFieldValue));
			}
			for (IssueLinkMapping mapping : option.getIssueLinkMappings()) {
				LinkSpec linkSpec = OneDev.getInstance(LinkSpecService.class).find(mapping.getOneDevIssueLink());
				if (linkSpec == null)
					throw new ExplicitException("No link spec found: " + mapping.getOneDevIssueLink());
				linkMappings.put(mapping.getYouTrackIssueLink(), linkSpec);
			}

			Set<String> nonExistentLogins = new LinkedHashSet<>();

View on GitHub (pinned to d44925c47c)

Solutions

  1. Re-generate the import option so field mappings match current OneDev issue settings.
  2. Add/recreate the missing custom field in the project's Issue Settings.
  3. Edit the mapping to point at an existing OneDev issue field.
  4. Remove mappings for fields you do not want imported.

Example fix

// before: mapping to deleted field
issueFieldMappings: [{youTrackIssueField: "Stage", oneDevIssueField: "Milestone::v1"}]

// after: field recreated in OneDev settings, or mapped to existing field
issueFieldMappings: [{youTrackIssueField: "Stage", oneDevIssueField: "Iteration::v1"}]
Defensive patterns

Strategy: validation

Validate before calling

// verify mapped fields exist in target project issue settings
IssueSetting setting = project.getIssueSetting();
for (IssueFieldMapping m : option.getIssueFieldMappings()) {
    if (setting.getFieldSpec(m.getOneDevIssueField()) == null)
        throw new IllegalStateException("Mapped OneDev field missing: " + m.getOneDevIssueField());
}

Try / catch

try { importServer.importIssues(...); } catch (ExplicitException e) { logger.error("Field mapping invalid: {}", e.getMessage()); }

Prevention

When it happens

Trigger: 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.

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

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/9a9dd1bec2cf8aea. Report an issue: GitHub.