theonedev/onedev · error · NotAcceptableException
Count should not be greater than ${RestConstants.MAX_PAGE_SI
Error message
Count should not be greater than ${RestConstants.MAX_PAGE_SIZE} What it means
queryIssues rejects a page size larger than RestConstants.MAX_PAGE_SIZE by throwing NotAcceptableException with this message. OneDev caps list endpoints to protect the server from huge result pages. The client must request count <= MAX_PAGE_SIZE and paginate with offset.
Source
Thrown at server-core/src/main/java/io/onedev/server/ai/TodResource.java:438
return DateUtils.parseRelaxed(dateTimeDescription).getTime();
}
@Path("/query-issues")
@GET
public List<Map<String, Object>> queryIssues(
@QueryParam("currentProject") @NotNull String currentProjectPath,
@QueryParam("project") String projectPath,
@QueryParam("query") String query,
@QueryParam("offset") int offset,
@QueryParam("count") int count) {
var subject = SecurityUtils.getSubject();
if (SecurityUtils.getUser(subject) == null)
throw new UnauthenticatedException();
var projectContext = getProjectContext(projectPath, currentProjectPath);
if (count > RestConstants.MAX_PAGE_SIZE)
throw new NotAcceptableException("Count should not be greater than " + RestConstants.MAX_PAGE_SIZE);
EntityQuery<Issue> parsedQuery;
if (query != null) {
var option = new IssueQueryParseOption();
option.withCurrentUserCriteria(true);
parsedQuery = IssueQuery.parse(projectContext.project, query, option, true);
} else {
parsedQuery = new IssueQuery(null, new ArrayList<>());
}
var summaries = new ArrayList<Map<String, Object>>();
for (var issue : issueService.query(subject, new ProjectScope(projectContext.project, true, false), parsedQuery, true, offset, count)) {
var summary = IssueHelper.getSummary(projectContext.currentProject, issue);
for (var entry: issue.getFieldInputs().entrySet()) {
summary.put(entry.getKey(), entry.getValue().getValues());
}
summary.put("link", urlService.urlFor(issue, true));
summaries.add(summary);View on GitHub (pinned to d44925c47c)
Solutions
- Lower the count parameter to RestConstants.MAX_PAGE_SIZE or below (e.g. count=100).
- Paginate: keep count at the max and step offset by count until fewer than count results return.
- Check RestConstants.MAX_PAGE_SIZE in the server version you run to know the exact cap.
Example fix
// before GET /api/tod/query-issues?query=state=Open&offset=0&count=500 // after GET /api/tod/query-issues?query=state=Open&offset=0&count=100 // then offset=100, offset=200 ...
Defensive patterns
Strategy: validation
Validate before calling
const MAX_PAGE_SIZE = 100;
function validateCount(count) {
const n = Number(count);
if (!Number.isInteger(n) || n <= 0 || n > MAX_PAGE_SIZE)
throw new RangeError(`count must be 1..${MAX_PAGE_SIZE}`);
return n;
} Try / catch
try {
return await queryIssues({ ...params, count: Math.min(params.count, 100) });
} catch (e) {
if (/Count should not be greater than/.test(e.message)) {
return paginate(params, 100);
}
throw e;
} Prevention
- Clamp count to the server max in your API wrapper.
- Implement offset-based pagination helpers instead of large single fetches.
- Pin the MAX_PAGE_SIZE constant per server version.
When it happens
Trigger: Calling the AI query-issues endpoint with a count query parameter whose integer value exceeds RestConstants.MAX_PAGE_SIZE (default 100 in OneDev REST constants), e.g. count=500.
Common situations: A client script passing a large count to 'get everything at once'; an AI agent guessing a page size; a UI forwarding an unbounded user-supplied page size.
Related errors
- Count should not be greater than
- Count should not be greater than 1000
- Count should not be greater than ${MAX_PAGE_SIZE}
- Count should not be greater than 100
- Unexpected query params:
AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06).
Data as JSON: /api/errors/2f493b1756256691.
Report an issue: GitHub.