{"record":{"id":"c0ecf290191eb64b","repo":"theonedev/onedev","slug":"unknown-order-ordertext","errorCode":null,"errorMessage":"Unknown order: ${orderText}","messagePattern":"Unknown order: (.+?)","errorType":"validation","errorClass":"ExplicitException","httpStatus":500,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/search/commit/CommitQuery.java","lineNumber":134,"sourceCode":"\t\t\t\t\tvar isSince = criteria.revisionCriteria().SINCE() != null;\n\n\t\t\t\t\tif (criteria.revisionCriteria().DefaultBranch() != null) {\n\t\t\t\t\t\tcriteriaValues.computeIfAbsent(RevisionCriteria.class, k->new ArrayList<>()).add(new Revision(type, null, isSince));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (var valueNode: criteria.revisionCriteria().Value()) {\n\t\t\t\t\t\t\tcriteriaValues.computeIfAbsent(RevisionCriteria.class, k->new ArrayList<>()).add(new Revision(type, getValue(valueNode), isSince));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (criteria.orderCriteria() != null) {\n\t\t\t\t\tOrder orderValue;\n\t\t\t\t\tif (criteria.orderCriteria().OrderByDate() != null) {\n\t\t\t\t\t\torderValue = Order.DATE;\n\t\t\t\t\t} else if (criteria.orderCriteria().OrderByAuthorDate() != null) {\n\t\t\t\t\t\torderValue = Order.AUTHOR_DATE;\n\t\t\t\t\t} else if (criteria.orderCriteria().OrderByTopo() != null) {\n\t\t\t\t\t\torderValue = Order.TOPO;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new ExplicitException(\"Unknown order: \" + criteria.orderCriteria().getText());\n\t\t\t\t\t}\n\t\t\t\t\tcriteriaValues.computeIfAbsent(OrderCriteria.class, k->new ArrayList<>()).add(orderValue);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (var entry: criteriaValues.entrySet()) {\n\t\t\t\tClass<? extends CommitCriteria> criteriaClass = entry.getKey();\n\t\t\t\tList<Object> values = entry.getValue();\n\t\t\t\tif (!values.isEmpty()) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcriterias.add(criteriaClass.getConstructor(List.class).newInstance(values));\n\t\t\t\t\t} catch (InstantiationException | IllegalAccessException | IllegalArgumentException\n\t\t\t\t\t\t\t| InvocationTargetException | NoSuchMethodException | SecurityException e) {\n\t\t\t\t\t\tthrow new RuntimeException(e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/search/commit/CommitQuery.java#L116-L152","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nCommitQuery.parse(project, \"order by bogus\", false);\n// after\nCommitQuery.parse(project, \"order by commit date\", false);","handlingStrategy":"try-catch","validationCode":"Set<String> valid = Set.of(\"commit date\", \"author date\", \"topo\");\nMatcher m = Pattern.compile(\"(?i)order\\\\s+by\\\\s+(.+)\").matcher(q);\nif (m.find() && !valid.contains(m.group(1).trim().toLowerCase()))\n    throw new IllegalArgumentException(\"Unknown order: \" + m.group(1));","typeGuard":null,"tryCatchPattern":"try {\n    return CommitQuery.parse(project, q, false);\n} catch (ExplicitException e) {\n    if (e.getMessage().startsWith(\"Unknown order:\"))\n        throw new UserFriendlyException(\"Order must be 'commit date', 'author date' or 'topo'\");\n    throw e;\n}","preventionTips":["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"],"tags":["commit-search","parsing","sorting"],"backgroundTag":"invalid-enum-value","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}