{"record":{"id":"84e8c1d28787f40f","repo":"hibernate/hibernate-orm","slug":"scroll-0-not-valid","errorCode":null,"errorMessage":"scroll(0) not valid","messagePattern":"scroll\\(0\\) not valid","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/internal/scrollable/FetchingScrollableResultsImpl.java","lineNumber":193,"sourceCode":"\t\t\t// scroll ahead\n\t\t\tfor ( int i = 0; i < positions; i++ ) {\n\t\t\t\tmore = next();\n\t\t\t\tif ( !more ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse if ( positions < 0 ) {\n\t\t\t// scroll backward\n\t\t\tfor ( int i = 0; i < -positions; i++ ) {\n\t\t\t\tmore = previous();\n\t\t\t\tif ( !more ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthrow new HibernateException( \"scroll(0) not valid\" );\n\t\t}\n\n\t\tafterScrollOperation();\n\n\t\treturn more;\n\t}\n\n\t@Override\n\tpublic boolean position(int position) {\n\t\treturn setRowNumber( position );\n\t}\n\n\t@Override\n\tpublic boolean last() {\n\t\tboolean more = false;\n\t\tif ( maxPosition != null ) {\n\t\t\tif ( currentPosition > maxPosition ) {\n\t\t\t\tmore = previous();","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/internal/scrollable/FetchingScrollableResultsImpl.java#L175-L211","documentation":"Error \"scroll(0) not valid\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/internal/scrollable/FetchingScrollableResultsImpl.java:193 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-zero row offset to scroll(); use absolute positioning or first()/next() instead of scroll(0)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}