{"record":{"id":"6b603b56d0f63982","repo":"invoke-ai/InvokeAI","slug":"invalid-request-must-provide-either-all-or-both","errorCode":null,"errorMessage":"Invalid request: Must provide either 'all' or both 'offset' and 'limit'","messagePattern":"Invalid request: Must provide either 'all' or both 'offset' and 'limit'","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"invokeai/app/api/routers/boards.py","lineNumber":231,"sourceCode":"    current_user: CurrentUserOrDefault,\n    order_by: BoardRecordOrderBy = Query(default=BoardRecordOrderBy.CreatedAt, description=\"The attribute to order by\"),\n    direction: SQLiteDirection = Query(default=SQLiteDirection.Descending, description=\"The direction to order by\"),\n    all: Optional[bool] = Query(default=None, description=\"Whether to list all boards\"),\n    offset: Optional[int] = Query(default=None, description=\"The page offset\"),\n    limit: Optional[int] = Query(default=None, description=\"The number of boards per page\"),\n    include_archived: bool = Query(default=False, description=\"Whether or not to include archived boards in list\"),\n) -> Union[OffsetPaginatedResults[BoardDTO], list[BoardDTO]]:\n    \"\"\"Gets a list of boards for the current user, including shared boards. Admin users see all boards.\"\"\"\n    if all:\n        return ApiDependencies.invoker.services.boards.get_all(\n            current_user.user_id, current_user.is_admin, order_by, direction, include_archived\n        )\n    elif offset is not None and limit is not None:\n        return ApiDependencies.invoker.services.boards.get_many(\n            current_user.user_id, current_user.is_admin, order_by, direction, offset, limit, include_archived\n        )\n    else:\n        raise HTTPException(\n            status_code=400,\n            detail=\"Invalid request: Must provide either 'all' or both 'offset' and 'limit'\",\n        )\n\n\n@boards_router.get(\n    \"/{board_id}/image_names\",\n    operation_id=\"list_all_board_image_names\",\n    response_model=list[str],\n)\ndef list_all_board_image_names(\n    current_user: CurrentUserOrDefault,\n    board_id: str = Path(description=\"The id of the board or 'none' for uncategorized images\"),\n    categories: list[ImageCategory] | None = Query(default=None, description=\"The categories of image to include.\"),\n    is_intermediate: bool | None = Query(default=None, description=\"Whether to list intermediate images.\"),\n) -> list[str]:\n    \"\"\"Gets a list of images for a board\"\"\"\n","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/boards.py#L213-L249","documentation":"HTTP 400 raised by list_boards when the request supplies neither all=true nor both offset and limit query parameters. The endpoint requires exactly one of these two pagination modes and rejects ambiguous/empty calls.","triggerScenarios":"GET /boards/ with no query params; or GET /boards/?offset=0 (limit missing); or GET /boards/?limit=10 (offset missing).","commonSituations":"Hand-written curl tests omitting pagination params; pagination state lost after a frontend refactor; API clients constructed with defaults that drop undefined query keys.","solutions":["Pass all=true to fetch every board","Or pass both offset and limit, e.g. ?offset=0&limit=20","Fix client pagination code so offset and limit are always sent together"],"exampleFix":"// before\nfetch('/api/v1/boards/?offset=0'); // 400\n// after\nfetch('/api/v1/boards/?offset=0&limit=20');","handlingStrategy":"validation","validationCode":"const params = new URLSearchParams();\nif (all) params.set('all', 'true');\nelse {\n  if (offset == null || limit == null) throw new Error('listBoards needs all=true or both offset and limit');\n  params.set('offset', String(offset)); params.set('limit', String(limit));\n}","typeGuard":"const isListBoardsQuery = (q) =>\n  q?.all === true || (Number.isInteger(q?.offset) && Number.isInteger(q?.limit));","tryCatchPattern":"try {\n  return await api.get('/boards/', { params });\n} catch (e) {\n  if (e.response?.status === 400) throw new Error('Invalid pagination: pass all=true or offset+limit');\n  throw e;\n}","preventionTips":["Always send offset and limit together, or use all=true","Build query params through a typed helper that rejects undefined pagination fields","Add client-side schema validation on the listBoards request params"],"tags":["http-400","validation","pagination","boards"],"backgroundTag":"missing-required-parameter","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}