Significant-Gravitas/AutoGPT · warning · HTTPException
Page must be greater than 0
Error message
Page must be greater than 0
What it means
HTTP 422 from GET /api/v1/store/agents (external store API). The route manually validates the `page` query parameter after FastAPI parsing: any integer < 1 (i.e. 0 or negative) is rejected. FastAPI only enforces the int type, so page=0 passes parsing and hits this explicit check.
Source
Thrown at autogpt_platform/backend/backend/api/external/v1/routes.py:349
page_size: int = 20,
) -> store_model.StoreAgentsResponse:
"""
Get a paginated list of agents from the store with optional filtering and sorting.
Args:
featured: Filter to only show featured agents
creator: Filter agents by creator username
sorted_by: Sort agents by "runs", "rating", "name", or "updated_at"
search_query: Search agents by name, subheading and description
category: Filter agents by category
page: Page number for pagination (default 1)
page_size: Number of agents per page (default 20)
Returns:
StoreAgentsResponse: Paginated list of agents matching the filters
"""
if page < 1:
raise HTTPException(status_code=422, detail="Page must be greater than 0")
if page_size < 1:
raise HTTPException(status_code=422, detail="Page size must be greater than 0")
agents = await store_cache._get_cached_store_agents(
featured=featured,
creator=creator,
sorted_by=sorted_by,
search_query=search_query,
category=category,
page=page,
page_size=page_size,
)
return agents
@v1_router.get(
path="/store/agents/{username}/{agent_name}",View on GitHub (pinned to 9c8bb5550f)
Solutions
- Use 1-based paging: the first page is page=1.
- If your client is zero-based, send page=zero_based_page+1.
- Clamp before sending: page = max(1, requested_page).
Example fix
// before
const res = await fetch(`/api/v1/store/agents?page=${pageIndex}`); // pageIndex starts at 0
// after
const res = await fetch(`/api/v1/store/agents?page=${pageIndex + 1}`); Defensive patterns
Strategy: validation
Validate before calling
const page = Math.max(1, rawPage); // enforce 1-based before fetch
Type guard
function isValidPage(p: number): boolean { return Number.isInteger(p) && p >= 1; } Prevention
- Treat page as 1-based everywhere in the client.
- Centralize query-string building for store endpoints in one helper that clamps page and page_size.
When it happens
Trigger: GET /api/v1/store/agents?page=0 or ?page=-2. Also generated clients that default page to 0 (zero-based paging conventions) or compute page as offset/page_size which yields 0 for the first page.
Common situations: Porting a client from a zero-based pagination API to this one-based API; frontend pager components initialized with currentPage=0; passing an uninitialized int before the state loads.
Related errors
- Page size must be greater than 0
- Title must not be blank
- builder_graph_id and expert_id are mutually exclusive
- Invalid page number
- Invalid page size
AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14).
Data as JSON: /api/errors/d72e5a99e9170fa8.
Report an issue: GitHub.