theonedev/onedev · error · NotAcceptableException
Count should not be greater than 100
Error message
Count should not be greater than 100
What it means
queryPullRequests rejects any requested page size above RestConstants.MAX_PAGE_SIZE (100) for non-administrator subjects with a NotAcceptableException (HTTP 406-style). OneDev caps REST page sizes to protect the server from expensive query executions; only administrators may request larger counts.
Source
Thrown at server-core/src/main/java/io/onedev/server/rest/resource/PullRequestResource.java:259
@Path("/{requestId}/fixed-issue-ids")
@GET
public Collection<Long> getFixedIssueIds(@PathParam("requestId") Long requestId) {
PullRequest pullRequest = pullRequestService.load(requestId);
if (!SecurityUtils.canReadCode(pullRequest.getProject()))
throw new UnauthorizedException();
return pullRequest.getFixedIssueIds();
}
@Api(order=1100)
@GET
public List<PullRequest> queryPullRequests(
@QueryParam("query") @Api(description="Syntax of this query is the same as in <a href='/~pulls'>pull requests page</a>", example="to be reviewed by me") String query,
@QueryParam("offset") @Api(example="0") int offset,
@QueryParam("count") @Api(example="100") int count) {
var subject = SecurityUtils.getSubject();
if (!SecurityUtils.isAdministrator(subject) && count > RestConstants.MAX_PAGE_SIZE)
throw new NotAcceptableException("Count should not be greater than " + RestConstants.MAX_PAGE_SIZE);
var parsedQuery = PullRequestQuery.parse(null, query, true);
return pullRequestService.query(subject, null, parsedQuery, false, offset, count);
}
@Api(order=1200)
@POST
public Response createPullRequest(@NotNull PullRequestOpenData data) {
User user = SecurityUtils.getUser();
ProjectAndBranch target = new ProjectAndBranch(data.getTargetProjectId(), data.getTargetBranch());
ProjectAndBranch source = new ProjectAndBranch(data.getSourceProjectId(), data.getSourceBranch());
if (!SecurityUtils.canReadCode(target.getProject()) || !SecurityUtils.canReadCode(source.getProject()))
throw new UnauthorizedException();
PullRequest request = new PullRequest();View on GitHub (pinned to d44925c47c)
Solutions
- Set count to 100 or less and paginate using the offset parameter (offset=0,100,200,...).
- Run the query as an administrator account/token if large pages are truly required.
- Update the integration's page-size constant to RestConstants.MAX_PAGE_SIZE (100).
Example fix
// before GET /~api/pull-requests?offset=0&count=1000 // after GET /~api/pull-requests?offset=0&count=100 GET /~api/pull-requests?offset=100&count=100
Defensive patterns
Strategy: validation
Validate before calling
const MAX_PAGE_SIZE = 100
if (!isAdmin && count > MAX_PAGE_SIZE) count = MAX_PAGE_SIZE
// then paginate
for (let offset = 0; ; offset += count) { await query(offset, count) } Try / catch
try {
return await api.get(`/pull-requests?offset=${o}&count=${c}`)
} catch (e) {
if (/Count should not be greater than/.test(e.message)) { c = 100; /* retry */ }
else throw e
} Prevention
- Cap count at 100 in every OneDev REST integration.
- Paginate with offset loops instead of large pages.
- Document that only admins may exceed the page cap.
- Centralize page-size as a shared constant.
When it happens
Trigger: GET /~api/pull-requests?count=500 by a regular user; hardcoded page sizes over 100 in scripts or integrations; an admin wrote the script (worked), then a normal service account ran it.
Common situations: Pagination loops using count=1000; migration/export tools copying settings between instances; ported scripts from other APIs that allow big pages.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- Count should not be greater than 1000
- Count should not be greater than ${MAX_PAGE_SIZE}
- Count should not be greater than ${RestConstants.MAX_PAGE_SI
- Count should not be greater than
- Error parsing query
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/76e76d30ea53fe14.
Report an issue: GitHub.