theonedev/onedev · error · ExplicitException
Job criteria is not supported here
Error message
Job criteria is not supported here
What it means
JobMatch.checkField validates that a criteria field name used in a job query is either 'Project' or 'Job'. The 'Job criteria is not supported here' ExplicitException is thrown when a query references the Job field but the caller explicitly disallowed job criteria (withJobCriteria=false), meaning job-name filtering is not valid in that query context.
Source
Thrown at server-core/src/main/java/io/onedev/server/job/match/JobMatch.java:140
}
@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) {View on GitHub (pinned to d44925c47c)
Solutions
- Remove the 'Job' criteria clause from the query, or move the query to a context that supports job criteria.
- If this is a code change, pass withJobCriteria=true to JobMatch.checkField / the criteria parser for the calling context.
- Use the 'Project' field instead if project-level filtering is what was intended.
Example fix
// before JobMatch.checkField(Build.NAME_JOB, true, false); // after JobMatch.checkField(Build.NAME_JOB, true, true);
Defensive patterns
Strategy: validation
Validate before calling
boolean jobAllowed = /* context allows job criteria */;
if (query.contains("Job ") && !jobAllowed) throw new IllegalArgumentException("Job criteria not allowed here"); Type guard
boolean isAllowedField(String f) { return f.equals(Build.NAME_PROJECT) || f.equals(Build.NAME_JOB); } Try / catch
try { parseCriteria(query); } catch (ExplicitException e) { log.error("Invalid job criteria: {}", e.getMessage()); } Prevention
- Only use Project/Job fields in job queries
- Check the query-context flags before adding criteria
- Reuse the query builder UI instead of hand-writing criteria
When it happens
Trigger: Calling a criteria-parsing/validation path (via visitFieldOperatorValueCriteria) that passes withJobCriteria=false while the parsed criteria contains a 'Job' field operator/value clause.
Common situations: Writing a build/job query in a context where filtering by job name is not permitted, e.g. certain branch or pull request criteria editors, or copy-pasting a query containing 'Job' criteria into a field that only accepts project-scoped criteria.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Invalid field: " + fieldName
- 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/366a746e7ee6a154.
Report an issue: GitHub.