{"record":{"id":"ce21bbc0f0b7cd7e","repo":"hibernate/hibernate-orm","slug":"unexpected-frame-exclusion-lastchild","errorCode":null,"errorMessage":"Unexpected frame exclusion: {lastChild}","messagePattern":"Unexpected frame exclusion: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":5403,"sourceCode":"\t\t\telse {\n\t\t\t\tframeStartIndex = 1;\n\t\t\t\tendKind = FrameKind.CURRENT_ROW;\n\t\t\t\tendExpression = null;\n\t\t\t}\n\t\t\tstartKind = getFrameKind( frameClause.getChild( frameStartIndex ) );\n\t\t\tstartExpression =\n\t\t\t\t\tstartKind == FrameKind.OFFSET_FOLLOWING || startKind == FrameKind.OFFSET_PRECEDING\n\t\t\t\t\t\t\t? (SqmExpression<?>) frameClause.getChild( frameStartIndex ).getChild( 0 ).accept( this )\n\t\t\t\t\t\t\t: null;\n\t\t\tfinal var lastChild = frameClause.getChild( frameClause.getChildCount() - 1 );\n\t\t\tif ( lastChild instanceof HqlParser.FrameExclusionContext ) {\n\t\t\t\tfinal var token = ((TerminalNode) lastChild.getChild( 1 )).getSymbol();\n\t\t\t\texclusion = switch ( token.getType() ) {\n\t\t\t\t\tcase HqlParser.CURRENT -> FrameExclusion.CURRENT_ROW;\n\t\t\t\t\tcase HqlParser.GROUP -> FrameExclusion.GROUP;\n\t\t\t\t\tcase HqlParser.TIES -> FrameExclusion.TIES;\n\t\t\t\t\tcase HqlParser.NO -> FrameExclusion.NO_OTHERS;\n\t\t\t\t\tdefault -> throw new IllegalArgumentException( \"Unexpected frame exclusion: \" + lastChild );\n\t\t\t\t};\n\t\t\t}\n\t\t\telse {\n\t\t\t\texclusion = FrameExclusion.NO_OTHERS;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tmode = FrameMode.RANGE;\n\t\t\tstartKind = FrameKind.UNBOUNDED_PRECEDING;\n\t\t\tstartExpression = null;\n\t\t\tendKind = FrameKind.CURRENT_ROW;\n\t\t\tendExpression = null;\n\t\t\texclusion = FrameExclusion.NO_OTHERS;\n\t\t}\n\t\treturn new SqmOver<>(\n\t\t\t\tfunction,\n\t\t\t\tpartitions,\n\t\t\t\torderList,","sourceCodeStart":5385,"sourceCodeEnd":5421,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L5385-L5421","documentation":"Thrown while parsing a window frame clause: the trailing frame-exclusion keyword matched none of the recognized exclusions (current row, group, ties, no others). An internal switch default echoing the last child of the frame clause, reached only when the grammar yields an unexpected exclusion token.","triggerScenarios":"The HQL parser produced a node the translator does not expect: Unexpected frame exclusion: <value>","commonSituations":"Usually an internal grammar edge case in window-frame or expression parsing; can surface with unusual but syntactically accepted HQL.","solutions":["The window frame exclusion is invalid. Use CURRENT ROW, GROUP, TIES, or NO OTHERS in the frame exclusion."],"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"}