theonedev/onedev · error · ExplicitException
Unexpected operator:
Error message
Unexpected operator:
What it means
Fallback branch of visitOperatorCriteria: if the ANTLR operator token type is none of the recognized cases (Online/Offline/Paused/HasRunningBuilds), the parser throws ExplicitException "Unexpected operator: <text>".
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/agent/AgentQuery.java:116
return new FuzzyCriteria(getValue(ctx.getText()));
}
@Override
public Criteria<Agent> visitOperatorCriteria(OperatorCriteriaContext ctx) {
if (forRunner)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
switch (ctx.operator.getType()) {
case Online:
return new OnlineCriteria();
case Offline:
return new OfflineCriteria();
case Paused:
return new PausedCriteria();
case HasRunningBuilds:
return new HasRunningBuildsCriteria();
default:
throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
}
}
@Override
public Criteria<Agent> visitOperatorValueCriteria(OperatorValueCriteriaContext ctx) {
if (forRunner && ctx.HasAttribute() == null)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
var criterias = new ArrayList<Criteria<Agent>>();
for (var quoted: ctx.criteriaValue.Quoted()) {
String value = getValue(quoted.getText());
if (ctx.HasAttribute() != null)
criterias.add(new HasAttributeCriteria(value));
else if (ctx.NotUsedSince() != null)
criterias.add(new NotUsedSinceCriteria(value));
else if (ctx.EverUsedSince() != null)
criterias.add(new EverUsedSinceCriteria(value));
else if (ctx.RanBuild() != null)View on GitHub (pinned to d44925c47c)
Solutions
- Use a supported operator: online, offline, paused, or has running builds
- Fix the typo/keyword spelling in the query
- Upgrade OneDev so the parser recognizes the newer operator
Example fix
// before q = "runnin" // typo // after q = "has running builds"
Defensive patterns
Strategy: validation
Validate before calling
Set.of("online","offline","paused","has running builds").contains(op); // must be true before parsing Try / catch
try { new AgentQuery(q, forRunner); } catch (ExplicitException e) { /* unknown operator — fix spelling */ } Prevention
- Use only documented operator keywords
- Keep client and server OneDev versions aligned
- Copy queries from the UI rather than retyping operators
When it happens
Trigger: A new or unexpected operator token reaches visitOperatorCriteria without a corresponding switch case — typically after grammar changes or an unrecognized keyword in the query.
Common situations: Running a newer client query against an older parser; typo in an operator keyword that the lexer still tokenizes as operator; plugin/extension adding new operators.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Criteria '' is not supported here
- Error parsing query
- Malformed query
- Cannot order by field:
- Attribute not found:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/1699c612f96449ab.
Report an issue: GitHub.