theonedev/onedev · error · ExplicitException

Field not found:

Error message

Field not found: 

What it means

IssueQuery.checkField validates that a field name used in an issue query criterion exists. It throws ExplicitException when getFieldSpec returns null and the name is not one of Issue.QUERY_FIELDS, i.e. the field is neither a built-in query field nor a custom field defined in the global issue setting.

Source

Thrown at server-core/src/main/java/io/onedev/server/search/entity/issue/IssueQuery.java:572

			return new IssueQuery();
		}
	}

	private static GlobalIssueSetting getGlobalIssueSetting() {
		if (WicketUtils.getPage() instanceof IssueSettingPage)
			return ((IssueSettingPage) WicketUtils.getPage()).getSetting();
		else
			return OneDev.getInstance(SettingService.class).getIssueSetting();
	}

	private static ExplicitException newOperatorException(String fieldName, int operator) {
		return new ExplicitException("Field '" + fieldName + "' is not applicable for operator '" + getRuleName(operator) + "'");
	}

	public static void checkField(String fieldName, int operator, IssueQueryParseOption option) {
		FieldSpec fieldSpec = getGlobalIssueSetting().getFieldSpec(fieldName);
		if (fieldSpec == null && !Issue.QUERY_FIELDS.contains(fieldName))
			throw new ExplicitException("Field not found: " + fieldName);
		switch (operator) {
			case IsEmpty:
			case IsNotEmpty:
				if (Issue.QUERY_FIELDS.contains(fieldName)
						&& !fieldName.equals(IssueSchedule.NAME_ITERATION)) {
					throw newOperatorException(fieldName, operator);
				}
				break;
			case IsMe:
			case IsNotMe:
				if (!(fieldSpec instanceof UserChoiceField && option.withCurrentUserCriteria()))
					throw newOperatorException(fieldName, operator);
				break;
			case IssueQueryLexer.IsCurrent:
				if (!(fieldName.equals(Issue.NAME_PROJECT) && option.withCurrentProjectCriteria()
						|| fieldSpec instanceof BuildChoiceField && option.withCurrentBuildCriteria()
						|| fieldSpec instanceof PullRequestChoiceField && option.withCurrentPullRequestCriteria()
						|| fieldSpec instanceof CommitField && option.withCurrentCommitCriteria()))

View on GitHub (pinned to d44925c47c)

Solutions

  1. Fix the field name to an existing built-in query field or custom field.
  2. Define the missing custom field in the global issue setting if it should exist.
  3. Update saved queries/reports after renaming or deleting custom fields.
  4. List available fields (issue setting field specs) to discover valid names.

Example fix

// before
"State is Open"
// after (valid field name)
"Status is Open"
Defensive patterns

Strategy: validation

Validate before calling

// Check field existence before building/using a query
var setting = OneDev.getInstance(SettingManager.class).getIssueSetting();
boolean valid = Issue.QUERY_FIELDS.contains(fieldName)
    || setting.getFieldSpecs().stream().anyMatch(s -> s.getName().equals(fieldName));
if (!valid) throw new IllegalArgumentException("Field not found: " + fieldName);

Try / catch

// catch during parse
try {
    IssueQuery query = IssueQuery.parse(option, queryString);
} catch (ExplicitException e) {
    reportInvalidField(e.getMessage());
}

Prevention

When it happens

Trigger: Calling checkField (via parse of field-operator or field-operator-value criteria) with a field name absent from Issue.QUERY_FIELDS and from the custom field specs.

Common situations: Misspelled field in a saved query; custom field renamed or deleted after queries were written; query copied from another project/instance with different custom fields.

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/4e163e2292df3176. Report an issue: GitHub.