{"record":{"id":"309a6d7a9c316212","repo":"hibernate/hibernate-orm","slug":"path-may-not-be-empty","errorCode":null,"errorMessage":"Path may not be empty","messagePattern":"Path may not be empty","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/Order.java","lineNumber":375,"sourceCode":"\n\tprivate jakarta.persistence.criteria.Order order(\n\t\t\tExpression<?> expression,\n\t\t\tCriteriaBuilder builder) {\n\t\treturn direction() == DESCENDING\n\t\t\t\t? builder.desc( expression, nullPrecedence() )\n\t\t\t\t: builder.asc( expression, nullPrecedence() );\n\t}\n\n\tprivate Expression<?> expression(Root<?> root, CriteriaBuilder builder) {\n\t\tfinal var path = path( root, attributeName() );\n\t\treturn caseSensitive() ? path : builder.lower( path.as( String.class ) );\n\t}\n\n\tprivate static Path<?> path(Root<?> root, String path) {\n\t\trequireNonNull( path, \"missing path\" );\n\t\tfinal var tokens = new StringTokenizer( path, \".\" );\n\t\tif ( !tokens.hasMoreTokens() ) {\n\t\t\tthrow new IllegalArgumentException( \"Path may not be empty\" );\n\t\t}\n\t\tPath<?> criteriaPath = root;\n\t\twhile ( tokens.hasMoreTokens() ) {\n\t\t\tcriteriaPath = criteriaPath.get( tokens.nextToken() );\n\t\t}\n\t\treturn criteriaPath;\n\t}\n\n\t/**\n\t * Reverse the direction of the given ordering list\n\t *\n\t * @param ordering a list of {@code Order} items\n\t * @return a new list, with each {@code Order} reversed\n\t *\n\t * @see #reverse()\n\t *\n\t * @since 6.5\n\t */","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/Order.java#L357-L393","documentation":"Path-parsing guard in Order's private path helper: after tokenizing the attribute path, no tokens remain (the path string was empty or only separators), so no criteria Path can be resolved for ordering. The faulty input is the attributeName/path string used to build the Order; supply a non-empty attribute path.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Provide a non-empty attribute path for the Order.","Use Order.asc/desc with a valid property name."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}