theonedev/onedev · error · ExplicitException
Unexpected operator:
Error message
Unexpected operator:
What it means
The CurrentIssue operator ("Current issue") refers to the issue being viewed, so IssueQuery.parse() accepts it only when IssueQueryParseOption.withCurrentIssueCriteria is enabled. When the flag is off, visitOperatorCriteria throws this ExplicitException. This keeps self-referential criteria out of contexts (like saved queries or issue lists) where there is no 'current issue'.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/issue/IssueQuery.java:243
return new FixedInCurrentBuildCriteria();
case FixedInCurrentPullRequest:
if (!option.withCurrentPullRequestCriteria())
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new FixedInCurrentPullRequestCriteria();
case FixedInCurrentCommit:
if (!option.withCurrentCommitCriteria())
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new FixedInCurrentCommitCriteria();
case ReferencedInCurrentBranch:
if (!option.withCurrentBranchCriteria())
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new ReferencedInCurrentBranchCriteria();
case CurrentIssue:
if (!option.withCurrentIssueCriteria())
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new CurrentIssueCriteria();
default:
throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
}
}
@Override
public Criteria<Issue> visitFieldOperatorCriteria(FieldOperatorCriteriaContext ctx) {
String fieldName = getValue(ctx.Quoted().getText());
int operator = ctx.operator.getType();
if (validate)
checkField(fieldName, operator, option);
if (fieldName.equals(NAME_PROJECT)) {
return new ProjectIsCurrentCriteria();
} else if (fieldName.equals(IssueSchedule.NAME_ITERATION)) {
return new IterationEmptyCriteria(operator);
} else {
FieldSpec fieldSpec = getGlobalIssueSetting().getFieldSpec(fieldName);
if (fieldSpec != null)
return new FieldOperatorCriteria(fieldName, operator, fieldSpec.isAllowMultiple());
elseView on GitHub (pinned to d44925c47c)
Solutions
- Remove the "Current issue" operator from the query or replace with an explicit issue-number criterion (e.g. "Number is 123").
- Parse with an IssueQueryParseOption that has withCurrentIssueCriteria enabled, only where a current issue exists.
- Handle ExplicitException and tell the user this operator is only supported on issue-detail-scoped queries.
Example fix
// before IssueQuery.parse(project, "Current issue", new IssueQueryParseOption(), true); // after IssueQueryParseOption option = new IssueQueryParseOption(); option.withCurrentIssueCriteria(true); IssueQuery.parse(project, "Current issue", option, true);
Defensive patterns
Strategy: validation
Validate before calling
if (!option.withCurrentIssueCriteria() && queryString.toLowerCase().contains("current issue"))
throw new IllegalArgumentException("'Current issue' only valid in issue-detail-scoped queries"); Type guard
boolean supportsCurrentIssueCriteria(IssueQueryParseOption option, String query) {
return option.withCurrentIssueCriteria() || !query.toLowerCase().contains("current issue");
} Try / catch
try {
IssueQuery.parse(project, queryString, option, true);
} catch (ExplicitException e) {
// suggest replacing with 'Number is <n>'
suggestQueryRewrite(e.getMessage());
} Prevention
- Use 'Current issue' only where an issue detail context exists
- Prefer explicit issue number criteria in saved/shared queries
- Catch ExplicitException and offer a rewrite suggestion
When it happens
Trigger: IssueQuery.parse() is invoked with a query containing "Current issue" while option.withCurrentIssueCriteria() is false, e.g. parsing on a context other than the issue detail page.
Common situations: Using "Current issue" in saved queries or project-wide filters; plugins parsing query strings copied from the issue detail page with default options.
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
- Unexpected operator
- State is required
- Issue ${issueReference} is not in current project
- Pull request submitter cannot be reviewer
- Job name is required
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/f77ebf9162b4abbc.
Report an issue: GitHub.