{"record":{"id":"03bf3aa2e1d061c2","repo":"quarkusio/quarkus","slug":"a-field-must-by-supplied-after-orderby-offendi","errorCode":null,"errorMessage":"A field must by supplied after 'OrderBy' . Offending method is ${repositoryMethodDescription}.","messagePattern":"A field must by supplied after 'OrderBy' \\. Offending method is (.+?)\\.","errorType":"exception","errorClass":"UnableToParseMethodException","httpStatus":null,"severity":"error","filePath":"extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java","lineNumber":149,"sourceCode":"        if (methodName.substring(0, byIndex).contains(\"Distinct\")) {\n            throw new UnableToParseMethodException(\n                    \"Distinct is not yet supported. Offending method is \" + repositoryMethodDescription + \".\");\n        }\n\n        // handle 'AllIgnoreCase'\n        String afterByPart = methodName.substring(byIndex + 2);\n        boolean allIgnoreCase = false;\n        if (afterByPart.contains(ALL_IGNORE_CASE)) {\n            allIgnoreCase = true;\n            afterByPart = afterByPart.replace(ALL_IGNORE_CASE, \"\");\n        }\n\n        // handle the 'OrderBy' clause which is assumed to be at the end of the query\n        Sort sort = null;\n        if (containsLogicOperator(afterByPart, ORDER_BY)) {\n            int orderByIndex = afterByPart.indexOf(ORDER_BY);\n            if (orderByIndex + ORDER_BY.length() == afterByPart.length()) {\n                throw new UnableToParseMethodException(\n                        \"A field must by supplied after 'OrderBy' . Offending method is \" + repositoryMethodDescription + \".\");\n            }\n            String afterOrderByPart = afterByPart.substring(orderByIndex + ORDER_BY.length());\n            afterByPart = afterByPart.substring(0, orderByIndex);\n            boolean ascending = true;\n            if (afterOrderByPart.endsWith(\"Asc\")) {\n                ascending = true;\n                afterOrderByPart = afterOrderByPart.replace(\"Asc\", \"\");\n            } else if (afterOrderByPart.endsWith(\"Desc\")) {\n                ascending = false;\n                afterOrderByPart = afterOrderByPart.replace(\"Desc\", \"\");\n            }\n            String orderField = lowerFirstLetter(afterOrderByPart);\n            if (!entityContainsField(orderField)) {\n                throw new UnableToParseMethodException(\n                        \"Field \" + orderField\n                                + \" which was configured as the order field does not exist in the entity. Offending method is \"\n                                + repositoryMethodDescription + \".\");","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/MethodNameParser.java#L131-L167","documentation":"When parsing the 'OrderBy' clause of a derived repository method name, the parser found 'OrderBy' as the last text with no field name following it. It throws UnableToParseMethodException because a sort field must be supplied after 'OrderBy'.","triggerScenarios":"Declaring a method ending exactly in 'OrderBy' (e.g. findAllByLastnameOrderBy, findByAgeOrderBy) — the substring after 'OrderBy' is empty.","commonSituations":"Typo or truncation while renaming methods; deleting the sort field during refactoring; copy-paste of method names that got cut off at the end.","solutions":["Append the field name (and optionally Asc/Desc) after OrderBy: e.g. ...OrderByLastnameAsc","Remove the OrderBy clause entirely if sorting is not needed and sort at call time with Sort.by(...) or a Pageable"],"exampleFix":"// before\nList<User> findByLastnameOrderBy(String lastname);\n// after\nList<User> findByLastnameOrderByLastnameAsc(String lastname);","handlingStrategy":"validation","validationCode":"// Regex check in a unit test:\n// assertTrue(methodName.matches(\".*OrderBy[A-Z].*(Asc|Desc)?\"), \"OrderBy needs a field: \" + methodName);","typeGuard":null,"tryCatchPattern":"try {\n    parser.parse(methodName);\n} catch (UnableToParseMethodException e) {\n    // complete the OrderBy clause or drop it\n    log.error(\"Derived method incomplete: \" + e.getMessage());\n}","preventionTips":["Always follow OrderBy with a field name, optionally suffixed Asc/Desc","Run a QuarkusTest that boots the app — all repository methods are parsed at startup/build","Don't truncate long method names during refactoring"],"tags":["jpa","spring-data","derived-query","syntax"],"backgroundTag":"unsupported-derived-query-method","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}