theonedev/onedev · error · ExplicitException
"Criteria '" + ctx.operator.getText() + "' is not supported
Error message
"Criteria '" + ctx.operator.getText() + "' is not supported here"
What it means
During parsing of an operator-only criterion (e.g. Active, Inactive, CreatedByMe), CreatedByMe is only allowed when the query context supports current-user criteria. Otherwise an ExplicitException naming the unsupported operator is thrown. The default case catches any operator not valid without a value.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/workspace/WorkspaceQuery.java:128
parser.setErrorHandler(new BailErrorStrategy());
QueryContext queryContext = parser.query();
CriteriaContext criteriaContext = queryContext.criteria();
Criteria<Workspace> workspaceCriteria;
if (criteriaContext != null) {
workspaceCriteria = new WorkspaceQueryBaseVisitor<Criteria<Workspace>>() {
@Override
public Criteria<Workspace> visitOperatorCriteria(OperatorCriteriaContext ctx) {
switch (ctx.operator.getType()) {
case Pending:
return new PendingCriteria();
case Active:
return new ActiveCriteria();
case Inactive:
return new InactiveCriteria();
case WorkspaceQueryLexer.CreatedByMe:
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new CreatedByMeCriteria();
default:
throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
}
}
@Override
public Criteria<Workspace> visitOperatorValueCriteria(OperatorValueCriteriaContext ctx) {
var criterias = new ArrayList<Criteria<Workspace>>();
for (var quoted : ctx.criteriaValue.Quoted()) {
String value = getValue(quoted.getText());
if (ctx.CreatedBy() != null)
criterias.add(new CreatedByUserCriteria(getUser(value)));
else if (ctx.RanOn() != null)
criterias.add(new RanOnCriteria(value));
else
throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
}View on GitHub (pinned to d44925c47c)
Solutions
- Replace 'created by me' with an explicit user criterion like 'created by "username"'.
- Use the query only in a context with an authenticated current user.
Example fix
// before created by me // parsed without current-user context // after created by "john"
Defensive patterns
Strategy: try-catch
Validate before calling
if (queryText.contains("created by me") && currentUser == null)
throw new IllegalArgumentException("'created by me' requires an authenticated user context"); Try / catch
try {
var query = WorkspaceQuery.parse(queryText);
} catch (ExplicitException e) {
// rewrite query without 'created by me' or report to user
} Prevention
- Only parse queries in authenticated user contexts
- Prefer explicit 'created by "user"' over 'created by me' in system contexts
When it happens
Trigger: A query like `created by me` parsed with withCurrentUserCriteria=false (e.g. parsed on behalf of anonymous/non-user context).
Common situations: Using 'created by me' in contexts where no current user exists, such as queries evaluated by agents or system jobs.
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: " + ctx.operator.getText()
- "Unexpected field: " + fieldName
- "Cannot order by field: " + fieldName
- "Field not found: " + fieldName
- Job name not available in match context
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/a0c543b9afc41bd1.
Report an issue: GitHub.