getredash/redash · error
Page size is out of range (1-250).
Error message
Page size is out of range (1-250).
What it means
Raised by paginate() in redash/handlers/base.py when page_size is greater than 250 or less than 1. Redash caps list endpoints at 250 items per page to bound response size and database load.
Source
Thrown at redash/handlers/base.py:90
rv = fn(*args, **kwargs)
if rv is None:
abort(404)
except NoResultFound:
abort(404)
return rv
def paginate(query_set, page, page_size, serializer, **kwargs):
count = query_set.count()
if page < 1:
abort(400, message="Page must be positive integer.")
if (page - 1) * page_size + 1 > count > 0:
abort(400, message="Page is out of range.")
if page_size > 250 or page_size < 1:
abort(400, message="Page size is out of range (1-250).")
results = query_set.paginate(page, page_size)
# support for old function based serializers
if isclass(serializer):
items = serializer(results.items, **kwargs).serialize()
else:
items = [serializer(result) for result in results.items]
return {"count": count, "page": page, "page_size": page_size, "results": items}
def org_scoped_rule(rule):
if settings.MULTI_ORG:
return "/<org_slug>{}".format(rule)
return rule
View on GitHub (pinned to ca79fe988d)
Solutions
- Set page_size between 1 and 250 inclusive.
- To fetch a large dataset, loop over pages of 250 using the page parameter rather than increasing page_size.
- Add client-side validation clamping page_size to 1-250.
Example fix
# before
resp = client.get('/api/queries?page=1&page_size=1000')
# after
resp = client.get('/api/queries?page=1&page_size=250') Defensive patterns
Strategy: validation
Validate before calling
page_size = min(max(int(page_size_arg), 1), 250)
Prevention
- Hard-code 250 as the client-side max page size for Redash list endpoints.
- Implement a paging loop instead of trying to fetch everything at once.
When it happens
Trigger: Calling a list endpoint with ?page_size=0, a negative page_size, or ?page_size=500. Also omitting page_size where a caller defaults it to 0.
Common situations: Porting a client from an API with different limits (e.g. 1000 per page); setting page_size equal to the total count to fetch everything in one request.
Related errors
- Page must be positive integer.
- Page is out of range.
- Unknown 'pagination.type' {}
- 'pagination.path' should be a string
- 'pagination.fields' should be a list of 2 field names
AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28).
Data as JSON: /api/errors/849b54fed57b28d9.
Report an issue: GitHub.