hibernate/hibernate-orm · error · IllegalArgumentException

Unexpected frame exclusion: {lastChild}

Error message

Unexpected frame exclusion: {lastChild}

What it means

Error "Unexpected frame exclusion: {lastChild}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:5403

			else {
				frameStartIndex = 1;
				endKind = FrameKind.CURRENT_ROW;
				endExpression = null;
			}
			startKind = getFrameKind( frameClause.getChild( frameStartIndex ) );
			startExpression =
					startKind == FrameKind.OFFSET_FOLLOWING || startKind == FrameKind.OFFSET_PRECEDING
							? (SqmExpression<?>) frameClause.getChild( frameStartIndex ).getChild( 0 ).accept( this )
							: null;
			final var lastChild = frameClause.getChild( frameClause.getChildCount() - 1 );
			if ( lastChild instanceof HqlParser.FrameExclusionContext ) {
				final var token = ((TerminalNode) lastChild.getChild( 1 )).getSymbol();
				exclusion = switch ( token.getType() ) {
					case HqlParser.CURRENT -> FrameExclusion.CURRENT_ROW;
					case HqlParser.GROUP -> FrameExclusion.GROUP;
					case HqlParser.TIES -> FrameExclusion.TIES;
					case HqlParser.NO -> FrameExclusion.NO_OTHERS;
					default -> throw new IllegalArgumentException( "Unexpected frame exclusion: " + lastChild );
				};
			}
			else {
				exclusion = FrameExclusion.NO_OTHERS;
			}
		}
		else {
			mode = FrameMode.RANGE;
			startKind = FrameKind.UNBOUNDED_PRECEDING;
			startExpression = null;
			endKind = FrameKind.CURRENT_ROW;
			endExpression = null;
			exclusion = FrameExclusion.NO_OTHERS;
		}
		return new SqmOver<>(
				function,
				partitions,
				orderList,

View on GitHub (pinned to fad1729dce)

Solutions

  1. The window frame exclusion is invalid. Use CURRENT ROW, GROUP, TIES, or NO OTHERS in the frame exclusion.

When it happens

Trigger: The HQL parser produced a node the translator does not expect: Unexpected frame exclusion: <value>

Common situations: Usually an internal grammar edge case in window-frame or expression parsing; can surface with unusual but syntactically accepted HQL.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/ce21bbc0f0b7cd7e. Report an issue: GitHub.