{"record":{"id":"d4285eae265aa5a6","repo":"hibernate/hibernate-orm","slug":"page-number-must-be-non-negative","errorCode":null,"errorMessage":"page number must be non-negative","messagePattern":"page number must be non-negative","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/Page.java","lineNumber":93,"sourceCode":"\t */\n\tpublic int getMaxResults() {\n\t\treturn size;\n\t}\n\n\t/**\n\t * @return the {@linkplain SelectionQuery#getFirstResult()\n\t *         offset} of this page.\n\t */\n\tpublic int getFirstResult() {\n\t\treturn size*number;\n\t}\n\n\tPage(int size, int number) {\n\t\tif ( size <= 0 ) {\n\t\t\tthrow new IllegalArgumentException(\"page size must be strictly positive\");\n\t\t}\n\t\tif ( number < 0 ) {\n\t\t\tthrow new IllegalArgumentException(\"page number must be non-negative\");\n\t\t}\n\t\tthis.size = size;\n\t\tthis.number = number;\n\t}\n\n\t/**\n\t * Obtain a page, numbered from {@code 0}, with the given size.\n\t * @param size the number of results on the initial page.\n\t * @param number the number of the page, where {@code 0} is the first page.\n\t */\n\tpublic static Page page(int size, int number) {\n\t\treturn new Page( size, number );\n\t}\n\n\t/**\n\t * Obtain an initial page with the given size.\n\t * @param size the number of results on the initial page.\n\t */","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/Page.java#L75-L111","documentation":"Error \"page number must be non-negative\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Pass a page number of zero or greater.","Validate pagination input from the caller."],"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"}