hibernate/hibernate-orm · error · HibernateException

scroll(0) not valid

Error message

scroll(0) not valid

What it means

Error "scroll(0) not valid" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/scrollable/FetchingScrollableResultsImpl.java:193

			// scroll ahead
			for ( int i = 0; i < positions; i++ ) {
				more = next();
				if ( !more ) {
					break;
				}
			}
		}
		else if ( positions < 0 ) {
			// scroll backward
			for ( int i = 0; i < -positions; i++ ) {
				more = previous();
				if ( !more ) {
					break;
				}
			}
		}
		else {
			throw new HibernateException( "scroll(0) not valid" );
		}

		afterScrollOperation();

		return more;
	}

	@Override
	public boolean position(int position) {
		return setRowNumber( position );
	}

	@Override
	public boolean last() {
		boolean more = false;
		if ( maxPosition != null ) {
			if ( currentPosition > maxPosition ) {
				more = previous();

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass a non-zero row offset to scroll(); use absolute positioning or first()/next() instead of scroll(0).

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/internal/scrollable/FetchingScrollableResultsImpl.java:193 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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