theonedev/onedev · error · ExplicitException
Job name not available in match context
Error message
Job name not available in match context
What it means
Thrown by JobCriteria.matches when the JobMatchContext has a null job name, making a job-name criteria (e.g. 'job is xxx') unevaluable. Job match contexts built for secret authorization often only carry branch/commit, not job name. Thrown as ExplicitException.
Source
Thrown at server-core/src/main/java/io/onedev/server/job/match/JobCriteria.java:36
private final String jobName;
private final int operator;
public JobCriteria(String jobName, int operator) {
this.jobName = jobName;
this.operator = operator;
}
@Override
public boolean matches(JobMatchContext context) {
if (context.getJobName() != null) {
var matches = WildcardUtils.matchString(jobName, context.getJobName());
if (operator == JobMatchLexer.IsNot)
matches = !matches;
return matches;
} else {
throw new ExplicitException("Job name not available in match context");
}
}
@Override
public Predicate getPredicate(@Nullable ProjectScope projectScope, CriteriaQuery<?> query, From<JobMatchContext, JobMatchContext> from,
CriteriaBuilder builder) {
throw new UnsupportedOperationException();
}
@Override
public String toStringWithoutParens() {
return quote(Build.NAME_JOB) + " "
+ JobMatch.getRuleName(operator)
+ " " + quote(jobName);
}
}
View on GitHub (pinned to d44925c47c)
Solutions
- Remove the job criteria from the authorization/match expression — use branch or commit criteria instead
- Use a criteria supported in that context (on branch, in project)
- Move job-name-based secret selection to conditions evaluated with full job context
- Split secrets per job if you need job-scoped authorization
Example fix
// before // authorization: "job is deploy-job" // after // authorization: "on branch main"
Defensive patterns
Strategy: validation
Validate before calling
// only include job criteria in expressions evaluated with a full match context // use "on branch ..." / commit criteria in secret authorization expressions
Try / catch
try {
jobMatch.matches(context);
} catch (ExplicitException e) {
// expression uses job criteria but context has no job name; rewrite expression
} Prevention
- Never use 'job ...' criteria in secret authorization expressions
- Know which fields each match context provides
- Prefer branch/commit criteria where job name is unavailable
When it happens
Trigger: A job match expression using a job criteria (e.g. 'job is deploy') is evaluated against a context without a job name — typically during job secret authorization where JobMatchContext is constructed with null jobName.
Common situations: Using a 'job ...' condition in a job secret's authorization expression (which evaluates before the job name is known); copy-pasting build condition expressions into secret authorization; version changes in the match context surface.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No authorized job secret found (project: {0}, job secret: {1
- Project criteria is not supported here
- Malformed job match
- Unexpected operator: " + ctx.operator.getText()
- Allocated agent not connected to current server, please retr
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/19a4689fdccdca19.
Report an issue: GitHub.