hibernate/hibernate-orm · error · IllegalArgumentException
KeyedPage was null
Error message
KeyedPage was null
What it means
Error "KeyedPage was null" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/SelectionQueryImpl.java:1041
final var context = new DelegatingDomainQueryExecutionContext(this) {
@Override
public QueryOptions getQueryOptions() {
return QueryOptions.NONE;
}
};
final var queryPlan = buildConcreteQueryPlan(
getSqmStatement().createCountQuery(),
Long.class,
null,
queryOptions
);
return queryPlan.executeQuery( context, SingleResultConsumer.instance() );
}
@Override
public KeyedResultList<R> getKeyedResultList(KeyedPage<R> keyedPage) {
if ( keyedPage == null ) {
throw new IllegalArgumentException( "KeyedPage was null" );
}
final var results =
new SelectionQueryImpl<KeyedResult<R>>( this, keyedPage )
.getResultList();
final int pageSize = keyedPage.getPage().getSize();
return new KeyedResultList<>(
collectResults( results, pageSize, keyedPage.getKeyInterpretation() ),
collectKeys( results, pageSize ),
keyedPage,
nextPage( keyedPage, results ),
previousPage( keyedPage, results )
);
}
// Used by Hibernate Reactive
public static <R> KeyedPage<R> nextPage(KeyedPage<R> keyedPage, List<KeyedResult<R>> results) {
if ( keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE ) {
// the results come in reverse orderView on GitHub (pinned to fad1729dce)
Solutions
- A null KeyedPage was supplied. Pass a non-null KeyedPage (from a previous page result) to fetch the next page.
When it happens
Trigger: Key-based pagination preconditions are not met: KeyedPage was null
Common situations: Using key-based pagination on queries with no/multiple roots, multi-item select lists, non-entity select items, or pages containing null key values.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/0bb7de3696e0d433.
Report an issue: GitHub.