hibernate/hibernate-orm · error · IllegalStateException
already at first page
Error message
already at first page
What it means
Error "already at first page" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/Page.java:129
*/
public static Page first(int size) {
return new Page( size, 0 );
}
/**
* Obtain the next page with the same size as this page.
*/
public Page next() {
return new Page( size, number+1 );
}
/**
* Obtain the previous page with the same size as this page.
* @throws IllegalStateException if this is the first page
*/
public Page previous() {
if ( isFirst() ) {
throw new IllegalStateException("already at first page");
}
return new Page( size, number-1 );
}
public Page first() {
return first( size );
}
/**
* Obtain a {@linkplain KeyedPage key-based specification} of this page.
*
* @param keyDefinition an {@link Order} object defining a total order
* on the result set
* @return a {@link KeyedPage} representing this page
*
* @since 6.5
*/
public <R> KeyedPage<R> keyedBy(Order<? super R> keyDefinition) {View on GitHub (pinned to fad1729dce)
Solutions
- Check hasPrevious()/page number before navigating to the previous page.
- Guard navigation logic at the first page boundary.
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/f5322e0af21720e1.
Report an issue: GitHub.