theonedev/onedev · error · ExplicitException
Unknown order: ${orderText}
Error message
Unknown order: ${orderText} What it means
CommitQuery.parse maps recognized order-by tokens (commit date, author date, topo) to Order enum values. If the orderCriteria text matches none of the expected alternatives, ExplicitException 'Unknown order: <text>' is thrown — indicating an unrecognized sort specification in the commit query.
Source
Thrown at server-core/src/main/java/io/onedev/server/search/commit/CommitQuery.java:134
var isSince = criteria.revisionCriteria().SINCE() != null;
if (criteria.revisionCriteria().DefaultBranch() != null) {
criteriaValues.computeIfAbsent(RevisionCriteria.class, k->new ArrayList<>()).add(new Revision(type, null, isSince));
} else {
for (var valueNode: criteria.revisionCriteria().Value()) {
criteriaValues.computeIfAbsent(RevisionCriteria.class, k->new ArrayList<>()).add(new Revision(type, getValue(valueNode), isSince));
}
}
} else if (criteria.orderCriteria() != null) {
Order orderValue;
if (criteria.orderCriteria().OrderByDate() != null) {
orderValue = Order.DATE;
} else if (criteria.orderCriteria().OrderByAuthorDate() != null) {
orderValue = Order.AUTHOR_DATE;
} else if (criteria.orderCriteria().OrderByTopo() != null) {
orderValue = Order.TOPO;
} else {
throw new ExplicitException("Unknown order: " + criteria.orderCriteria().getText());
}
criteriaValues.computeIfAbsent(OrderCriteria.class, k->new ArrayList<>()).add(orderValue);
}
}
for (var entry: criteriaValues.entrySet()) {
Class<? extends CommitCriteria> criteriaClass = entry.getKey();
List<Object> values = entry.getValue();
if (!values.isEmpty()) {
try {
criterias.add(criteriaClass.getConstructor(List.class).newInstance(values));
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e);
}
}
}
}View on GitHub (pinned to d44925c47c)
Solutions
- Use one of the supported order keywords (commit date, author date, topo) in the query.
- Remove the order criterion to accept the default ordering.
- Align parser grammar/generated classes with the query syntax version (rebuild ANTLR sources or upgrade OneDev); catch ExplicitException for a user-friendly message.
Example fix
// before CommitQuery.parse(project, "order by bogus", false); // after CommitQuery.parse(project, "order by commit date", false);
Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> valid = Set.of("commit date", "author date", "topo");
Matcher m = Pattern.compile("(?i)order\\s+by\\s+(.+)").matcher(q);
if (m.find() && !valid.contains(m.group(1).trim().toLowerCase()))
throw new IllegalArgumentException("Unknown order: " + m.group(1)); Try / catch
try {
return CommitQuery.parse(project, q, false);
} catch (ExplicitException e) {
if (e.getMessage().startsWith("Unknown order:"))
throw new UserFriendlyException("Order must be 'commit date', 'author date' or 'topo'");
throw e;
} Prevention
- Use only supported order-by keywords in commit queries
- Omit the order clause when default ordering suffices
- Validate order tokens against the current OneDev version's grammar
When it happens
Trigger: A commit query whose order criteria text (criteria.orderCriteria().getText()) is not one of the supported order tokens, encountered while parsing e.g. 'order by bogus' style input in CommitQuery.parse.
Common situations: Typing an unsupported order-by keyword in a commit search; grammar-version mismatch where a query written for another OneDev version uses an order token no longer/ not yet supported.
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
- Malformed query
- Criteria '${criteriaText}' is not supported here
- Unknown revision type
- Invalid reference number: <numberString>
- Invalid entity reference: <referenceString>
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/c0ecf290191eb64b.
Report an issue: GitHub.