theonedev/onedev · error · ExplicitException
Criteria '' is not supported here
Error message
Criteria '' is not supported here
What it means
Inside visitOperatorCriteria, the MentionedMe criteria is only allowed when the query was parsed with withCurrentUserCriteria=true. When parsing in a context that disallows current-user-dependent criteria (e.g. server-side or shared queries), an ExplicitException "Criteria 'MentionedMe' is not supported here" is thrown. The message interpolates ctx.operator.getText(), the literal operator token.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/entity/codecomment/CodeCommentQuery.java:125
CriteriaContext criteriaContext = queryContext.criteria();
Criteria<CodeComment> commentCriteria;
if (criteriaContext != null) {
commentCriteria = new CodeCommentQueryBaseVisitor<Criteria<CodeComment>>() {
@Override
public Criteria<CodeComment> visitFuzzyCriteria(FuzzyCriteriaContext ctx) {
return new FuzzyCriteria(getValue(ctx.getText()));
}
@Override
public Criteria<CodeComment> visitOperatorCriteria(OperatorCriteriaContext ctx) {
switch (ctx.operator.getType()) {
case Resolved:
return new ResolvedCriteria();
case Unresolved:
return new UnresolvedCriteria();
case MentionedMe:
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new MentionedMeCriteria();
case CreatedByMe:
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new CreatedByMeCriteria();
case RepliedByMe:
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + ctx.operator.getText() + "' is not supported here");
return new RepliedByMeCriteria();
default:
throw new ExplicitException("Unexpected operator: " + ctx.operator.getText());
}
}
@Override
public Criteria<CodeComment> visitOperatorValueCriteria(OperatorValueCriteriaContext ctx) {
int operator = ctx.operator.getType();
var criterias = new ArrayList<Criteria<CodeComment>>();View on GitHub (pinned to d44925c47c)
Solutions
- Remove the MentionedMe criterion from the query, or replace it with "Mentioned(\"<user name>\")" naming an explicit user.
- Parse with withCurrentUserCriteria=true if the query is executed for an interactive, logged-in user.
- Ensure the user is logged in (User.get() != null) before allowing current-user criteria.
- Catch ExplicitException around parse() and show a clear message that MentionedMe is unavailable in this context.
Example fix
// before var query = CodeCommentQuery.parse(project, "MentionedMe", false); // not supported here // after var query = CodeCommentQuery.parse(project, "Mentioned(\"alice\")", false); // explicit user
Defensive patterns
Strategy: validation
Validate before calling
// reject current-user criteria when parsing user-independent queries
static boolean usesCurrentUserCriteria(String q) {
return q.matches(".*\\b(MentionedMe|CreatedByMe|RepliedByMe)\\b.*");
}
// only call parse(..., withCurrentUserCriteria=true) if usesCurrentUserCriteria(q) is acceptable in this context Try / catch
try {
var query = CodeCommentQuery.parse(project, queryString, false);
} catch (ExplicitException e) {
showUserError(e.getMessage()); // e.g. Criteria 'MentionedMe' is not supported here
} Prevention
- Do not put MentionedMe/CreatedByMe/RepliedByMe into saved or shared queries.
- Prefer explicit-user forms like Mentioned("alice") in shared contexts.
- Check whether the target context allows current-user criteria before building the query.
When it happens
Trigger: CodeCommentQuery.parse(project, queryString, false) encountering the operator 'MentionedMe' (e.g. query text "MentionedMe") in a context where current-user criteria are disabled.
Common situations: Using a saved/shared or subscription query (which must be user-independent) that contains 'MentionedMe'; embedding a personal query into a context that forbids current-user criteria; API calls building queries on behalf of the system rather than a user.
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
- Malformed query
- Unexpected operator:
- Cannot order by field:
- Field not found:
- Please login to perform this query
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/0720feb0d76bda1f.
Report an issue: GitHub.