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

  1. Reduce the requested page number to <= MAX_PAGES; navigate to a smaller page.
  2. Narrow the commit query (filter by path/author/date) so needed commits appear on early pages.
  3. 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

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


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/b477867be001d729. Report an issue: GitHub.