theonedev/onedev · error · ExplicitException
Page should be no more than {MAX_PAGES}
Error message
Page should be no more than {MAX_PAGES} What it means
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.
Source
Thrown at server-core/src/main/java/io/onedev/server/web/component/commit/list/CommitListPanel.java:149
separated.add(null);
}
separated.add(commit);
}
return separated;
}
@Override
protected Commits load() {
CommitQuery query = queryModel.getObject();
Commits commits = new Commits();
List<String> commitHashes;
if (query != null) {
try {
RevListOptions options = new RevListOptions();
options.ignoreCase(true);
if (page > MAX_PAGES)
throw new ExplicitException("Page should be no more than " + MAX_PAGES);
options.count(page * COMMITS_PER_PAGE);
query.fill(getProject(), options);
if (options.revisions().isEmpty() && getCompareWith() != null)
options.revisions(Lists.newArrayList(getCompareWith()));
commitHashes = gitService.revList(getProject(), options);
} catch (Exception e) {
var explicitException = ExceptionUtils.find(e, ExplicitException.class);
if (explicitException != null) {
error(explicitException.getMessage());
} else {
error(_T("Error calculating commits: check log for details"));
logger.error("Error calculating commits", e);
}
commitHashes = new ArrayList<>();View on GitHub (pinned to d44925c47c)
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().
Example fix
// before int page = Integer.parseInt(pageParam); // may be huge panel.load(page); // after int page = Math.min(Integer.parseInt(pageParam), CommitListPanel.MAX_PAGES); panel.load(page);
Defensive patterns
Strategy: validation
Validate before calling
if (page > CommitListPanel.MAX_PAGES)
page = CommitListPanel.MAX_PAGES; // or reject with a friendly message Type guard
static boolean isValidPage(int page) {
return page >= 1 && page <= CommitListPanel.MAX_PAGES;
} Try / catch
try {
panel.load(page);
} catch (ExplicitException e) {
feedback.error("Page number exceeds the maximum of " + CommitListPanel.MAX_PAGES);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Count should not be greater than ${RestConstants.MAX_PAGE_SI
- Count should not be greater than
- Invalid commit id
- Count should not be greater than 1000
- Ref name should start with refs/
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/b477867be001d729.
Report an issue: GitHub.