theonedev/onedev · error · ExplicitException
Criteria '${criteriaText}' is not supported here
Error message
Criteria '${criteriaText}' is not supported here What it means
CommitQuery.parse walks the parsed criteria and rejects the 'Authored by me' criterion when the query is parsed without current-user context (withCurrentUserCriteria == false), throwing ExplicitException 'Criteria <text> is not supported here'. Some contexts (e.g. queries evaluated for other users or scheduled jobs) cannot resolve 'me', so the criterion is disallowed.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/commit/CommitQuery.java:76
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line,
int charPositionInLine, String msg, RecognitionException e) {
throw new RuntimeException("Malformed query", e);
}
});
CommonTokenStream tokens = new CommonTokenStream(lexer);
CommitQueryParser parser = new CommitQueryParser(tokens);
parser.removeErrorListeners();
parser.setErrorHandler(new BailErrorStrategy());
Map<Class<? extends CommitCriteria>, List<Object>> criteriaValues = new LinkedHashMap<>();
for (CriteriaContext criteria: parser.query().criteria()) {
if (criteria.authorCriteria() != null) {
if (criteria.authorCriteria().AuthoredByMe() != null) {
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + criteria.authorCriteria().AuthoredByMe().getText() + "' is not supported here");
criteriaValues.computeIfAbsent(AuthorCriteria.class, k->new ArrayList<>()).add(null);
} else {
for (var value: criteria.authorCriteria().Value())
criteriaValues.computeIfAbsent(AuthorCriteria.class, k->new ArrayList<>()).add(getValue(value));
}
} else if (criteria.committerCriteria() != null) {
if (criteria.committerCriteria().CommittedByMe() != null) {
if (!withCurrentUserCriteria)
throw new ExplicitException("Criteria '" + criteria.committerCriteria().CommittedByMe().getText() + "' is not supported here");
criteriaValues.computeIfAbsent(CommitterCriteria.class, k->new ArrayList<>()).add(null);
} else {
for (var value: criteria.committerCriteria().Value())
criteriaValues.computeIfAbsent(CommitterCriteria.class, k->new ArrayList<>()).add(getValue(value));
}
} else if (criteria.messageCriteria() != null) {
for (var value: criteria.messageCriteria().Value())
criteriaValues.computeIfAbsent(MessageCriteria.class, k->new ArrayList<>()).add(getValue(value));
} else if (criteria.fuzzyCriteria() != null) {View on GitHub (pinned to d44925c47c)
Solutions
- Replace 'Authored by me' with an explicit author name/value, e.g. author("login").
- Parse the query with withCurrentUserCriteria=true if the evaluation context does have a current user.
- Catch ExplicitException to return a clear message that the criterion is unsupported in this context.
Example fix
// before CommitQuery.parse(project, "authored by me", false); // after CommitQuery.parse(project, "author(\"john\")", false);
Defensive patterns
Strategy: validation
Validate before calling
if (withCurrentUserCriteria == false && queryString.matches("(?i).*authored\\s+by\\s+me.*"))
throw new IllegalArgumentException("'Authored by me' needs a current-user context"); Try / catch
try {
return CommitQuery.parse(project, q, false);
} catch (ExplicitException e) {
if (e.getMessage().contains("not supported here"))
throw new UserFriendlyException("Replace 'me' criteria with explicit values in this context");
throw e;
} Prevention
- Use explicit author names in shared/scheduled queries, never 'me'
- Only pass withCurrentUserCriteria=true when a valid user session exists
- Document which query contexts resolve current-user criteria
When it happens
Trigger: Parsing a commit query containing 'Authored by me' (AuthoredByMe token) while CommitQuery.parse is called with withCurrentUserCriteria=false — e.g. in contexts with no security context / impersonation available.
Common situations: Using 'Authored by me' in a commit query evaluated server-side outside a user session (webhook, scheduled report); embedding the query in a setting where current user is undefined; copy-pasting a personal query into a shared context.
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
- Unknown revision type
- Unknown order: ${orderText}
- Invalid reference number: <numberString>
- Invalid entity reference: <referenceString>
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/e896a9dd087c6a42.
Report an issue: GitHub.