{"record":{"id":"b477867be001d729","repo":"theonedev/onedev","slug":"page-should-be-no-more-than-max-pages","errorCode":null,"errorMessage":"Page should be no more than {MAX_PAGES}","messagePattern":"Page should be no more than (.+?)","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/web/component/commit/list/CommitListPanel.java","lineNumber":149,"sourceCode":"\t\t\t\t\tseparated.add(null);\n\t\t\t\t} \n\t\t\t\tseparated.add(commit);\n\t\t\t}\n\t\t\treturn separated;\n\t\t}\n\t\t\n\t\t@Override\n\t\tprotected Commits load() {\n\t\t\tCommitQuery query = queryModel.getObject();\n\t\t\tCommits commits = new Commits();\n\t\t\tList<String> commitHashes;\n\t\t\tif (query != null) {\n\t\t\t\ttry {\n\t\t\t\t\tRevListOptions options = new RevListOptions();\n\t\t\t\t\toptions.ignoreCase(true);\n\t\t\t\t\t\n\t\t\t\t\tif (page > MAX_PAGES)\n\t\t\t\t\t\tthrow new ExplicitException(\"Page should be no more than \" + MAX_PAGES);\n\t\t\t\t\t\n\t\t\t\t\toptions.count(page * COMMITS_PER_PAGE);\n\t\t\t\t\t\n\t\t\t\t\tquery.fill(getProject(), options);\n\t\t\t\t\t\n\t\t\t\t\tif (options.revisions().isEmpty() && getCompareWith() != null)\n\t\t\t\t\t\toptions.revisions(Lists.newArrayList(getCompareWith()));\n\t\t\t\t\t\n\t\t\t\t\tcommitHashes = gitService.revList(getProject(), options);\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tvar explicitException = ExceptionUtils.find(e, ExplicitException.class);\n\t\t\t\t\tif (explicitException != null) {\n\t\t\t\t\t\terror(explicitException.getMessage());\n\t\t\t\t\t} else {\n\t\t\t\t\t\terror(_T(\"Error calculating commits: check log for details\"));\n\t\t\t\t\t\tlogger.error(\"Error calculating commits\", e);\n\t\t\t\t\t}\n\t\t\t\t\tcommitHashes = new ArrayList<>();","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/web/component/commit/list/CommitListPanel.java#L131-L167","documentation":"CommitListPanel's load() paginates commit listings and caps paging at MAX_PAGES; requesting a page number greater than the cap throws this ExplicitException before building RevListOptions. This prevents unbounded \"page * COMMITS_PER_PAGE\" revision counts from overloading git.","triggerScenarios":"Requesting a commit list page whose number exceeds MAX_PAGES, e.g. clicking a high page number in the commit list UI or calling the panel/load path with page > MAX_PAGES.","commonSituations":"Deep-linking to a very high commit-list page; scripted pagination loops that ignore the page cap; UI state carrying a stale large page number after settings change.","solutions":["Reduce the requested page number to <= MAX_PAGES; navigate to a smaller page.","Narrow the commit query (filter by path/author/date) so needed commits appear on early pages.","In code, clamp page to MAX_PAGES before invoking load()."],"exampleFix":"// before\nint page = Integer.parseInt(pageParam); // may be huge\npanel.load(page);\n\n// after\nint page = Math.min(Integer.parseInt(pageParam), CommitListPanel.MAX_PAGES);\npanel.load(page);","handlingStrategy":"validation","validationCode":"if (page > CommitListPanel.MAX_PAGES)\n    page = CommitListPanel.MAX_PAGES; // or reject with a friendly message","typeGuard":"static boolean isValidPage(int page) {\n    return page >= 1 && page <= CommitListPanel.MAX_PAGES;\n}","tryCatchPattern":"try {\n    panel.load(page);\n} catch (ExplicitException e) {\n    feedback.error(\"Page number exceeds the maximum of \" + CommitListPanel.MAX_PAGES);\n}","preventionTips":["Clamp page numbers parsed from URLs before loading.","Use query filters to narrow commit ranges instead of deep paging.","Loop pagination code should stop at MAX_PAGES."],"tags":["pagination","git","limit","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}