theonedev/onedev · error · ExplicitException
Invalid field: " + fieldName
Error message
Invalid field: " + fieldName
What it means
JobMatch.checkField only accepts two field names: Build.NAME_PROJECT and Build.NAME_JOB. Any other field name in a job criteria clause throws 'Invalid field: <fieldName>', an ExplicitException signaling the criteria references a field that does not exist for job matching.
Source
Thrown at server-core/src/main/java/io/onedev/server/job/match/JobMatch.java:142
@Override
public Criteria<io.onedev.server.job.match.JobMatchContext> visitNotCriteria(JobMatchParser.NotCriteriaContext ctx) {
return new NotCriteria<>(visit(ctx.criteria()));
}
}.visit(JobMatchContext.criteria());
return new JobMatch(criteria);
}
public static void checkField(String fieldName, boolean withProjectCriteria, boolean withJobCriteria) {
if (fieldName.equals(Build.NAME_PROJECT)) {
if (!withProjectCriteria)
throw new ExplicitException("Project criteria is not supported here");
} else if (fieldName.equals(Build.NAME_JOB)) {
if (!withJobCriteria)
throw new ExplicitException("Job criteria is not supported here");
} else {
throw new ExplicitException("Invalid field: " + fieldName);
}
}
@Override
public boolean matches(JobMatchContext context) {
return criteria.matches(context);
}
@Override
public Predicate getPredicate(@Nullable ProjectScope projectScope, CriteriaQuery<?> query, From<JobMatchContext, JobMatchContext> from,
CriteriaBuilder builder) {
throw new UnsupportedOperationException();
}
@Override
public void onMoveProject(String oldPath, String newPath) {
criteria.onMoveProject(oldPath, newPath);
}View on GitHub (pinned to d44925c47c)
Solutions
- Correct the field name in the criteria to 'Project' or 'Job'.
- Remove the offending criteria clause.
- Check OneDev documentation for the supported job query fields.
Example fix
// before criteria: "Branch == master" // after criteria: "Job == \"my job\""
Defensive patterns
Strategy: validation
Validate before calling
Set<String> allowed = Set.of(Build.NAME_PROJECT, Build.NAME_JOB);
if (!allowed.contains(fieldName)) throw new IllegalArgumentException("Invalid field: " + fieldName); Type guard
boolean isValidJobField(String f) { return f.equals(Build.NAME_PROJECT) || f.equals(Build.NAME_JOB); } Try / catch
try { JobMatch.checkField(fieldName, true, true); } catch (ExplicitException e) { /* show user invalid-field message */ } Prevention
- Use autocomplete from the query editor
- Keep a list of valid fields handy
- Validate saved queries after OneDev upgrades
When it happens
Trigger: A criteria clause of the form <field> <operator> <value> is parsed (visitFieldOperatorValueCriteria) where <field> is neither 'Project' nor 'Job'.
Common situations: Typo in a query field name, using fields valid for issue/build queries (e.g. 'Branch', 'Status') in a job query, or an old query written for a previous schema.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Job criteria is not supported here
- Issue schedule permission required to set iterations
- Iteration '${iterationName}' not found
- No permission to update issue fields
- State is required
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/50d3c1d015fd4cde.
Report an issue: GitHub.