theonedev/onedev · error · ExplicitException
"Field not found: " + fieldName
Error message
"Field not found: " + fieldName
What it means
checkField validates that a field name used with an operator exists in PullRequest.QUERY_FIELDS and additionally that date-range operators (is since / is until) are only combined with date fields (submit date, last activity, close date). Unknown fields throw this ExplicitException before any criteria object is built.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/pullrequest/PullRequestQuery.java:477
if (order.direction.getText().equals("desc"))
requestSort.setDirection(DESCENDING);
else
requestSort.setDirection(ASCENDING);
} else {
requestSort.setDirection(sortField.getDefaultDirection());
}
requestSorts.add(requestSort);
}
return new PullRequestQuery(requestCriteria, requestSorts);
} else {
return new PullRequestQuery();
}
}
public static void checkField(String fieldName, int operator) {
if (!PullRequest.QUERY_FIELDS.contains(fieldName))
throw new ExplicitException("Field not found: " + fieldName);
switch (operator) {
case IsUntil:
case IsSince:
if (!fieldName.equals(PullRequest.NAME_SUBMIT_DATE)
&& !fieldName.equals(PullRequest.NAME_LAST_ACTIVITY_DATE)
&& !fieldName.equals(PullRequest.NAME_CLOSE_DATE)) {
throw newOperatorException(fieldName, operator);
}
break;
case Contains:
if (!fieldName.equals(PullRequest.NAME_TITLE)
&& !fieldName.equals(PullRequest.NAME_DESCRIPTION)
&& !fieldName.equals(PullRequest.NAME_COMMENT)) {
throw newOperatorException(fieldName, operator);
}
break;
case Is:
case IsNot:View on GitHub (pinned to d44925c47c)
Solutions
- Use a field listed in the pull request query help (e.g. number, title, description, submitter, assignees, state, submit date, close date, last activity date).
- Fix the spelling to the exact query field name.
- If the field belongs to issues or builds, run the query against the matching entity query type instead.
- After an upgrade, update saved queries whose fields were renamed/removed per release notes.
Example fix
// before
PullRequestQuery.parse("priority is high"); // field not in QUERY_FIELDS
// after
PullRequestQuery.parse("state is open"); Defensive patterns
Strategy: validation
Validate before calling
Set<String> PR_FIELDS = Set.of("number","title","state","description","submitter","assignees","submit date","close date","last activity date");
if (!PR_FIELDS.contains(fieldName))
throw new IllegalArgumentException("Field not found: " + fieldName); Type guard
boolean isPrQueryField(String f) { return PR_FIELDS.contains(f); } Try / catch
try {
PullRequestQuery.parse(query);
} catch (ExplicitException e) {
if (e.getMessage().startsWith("Field not found"))
suggestFields(e.getMessage()); // show valid field list to user
throw e;
} Prevention
- Cross-check field names with the target entity's query help
- Don't reuse issue/build field names in PR queries
- Re-validate saved queries after OneDev upgrades
When it happens
Trigger: A query like '<unknown field> is ...' parsed for pull requests, where the field name is not in PullRequest.QUERY_FIELDS — misspellings, fields from other entities, or fields removed in newer OneDev versions.
Common situations: Typing 'milestone is ...' or 'priority is ...' (issue fields) into pull request search; typos like 'submitdate'; saved queries broken after an upgrade renamed fields.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- "Unexpected operator: " + ctx.operator.getText()
- Reviewer not found:
- Pull request submitter cannot be reviewer
- Assignee not found:
- No permission to read code of source project:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/1c32399948020634.
Report an issue: GitHub.