{"record":{"id":"0875b06fc6f528cc","repo":"invoke-ai/InvokeAI","slug":"no-images-or-board-id-specified","errorCode":null,"errorMessage":"No images or board id specified.","messagePattern":"No images or board id specified\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"invokeai/app/api/routers/images.py","lineNumber":778,"sourceCode":"\n@images_router.post(\n    \"/download\", operation_id=\"download_images_from_list\", response_model=ImagesDownloaded, status_code=202\n)\ndef download_images_from_list(\n    current_user: CurrentUserOrDefault,\n    background_tasks: BackgroundTasks,\n    image_names: Optional[list[ImageName]] = Body(\n        default=None,\n        description=\"The list of names of images to download\",\n        embed=True,\n        max_length=MAX_IMAGE_BATCH_SIZE,\n    ),\n    board_id: Optional[str] = Body(\n        default=None, description=\"The board from which image should be downloaded\", embed=True\n    ),\n) -> ImagesDownloaded:\n    if (image_names is None or len(image_names) == 0) and board_id is None:\n        raise HTTPException(status_code=400, detail=\"No images or board id specified.\")\n\n    # Validate that the caller can read every image they are requesting.\n    # For a board_id request, check board visibility; for explicit image names,\n    # check each image individually.\n    if board_id:\n        _assert_board_read_access(board_id, current_user)\n    if image_names:\n        for name in image_names:\n            _assert_image_read_access(name, current_user)\n\n    assert_image_move_maintenance_inactive()\n\n    bulk_download_item_id: str = ApiDependencies.invoker.services.bulk_download.generate_item_id(board_id)\n\n    background_tasks.add_task(\n        ApiDependencies.invoker.services.bulk_download.handler,\n        image_names,\n        board_id,","sourceCodeStart":760,"sourceCodeEnd":796,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/images.py#L760-L796","documentation":"HTTP 400 raised by POST /images/download when the request body contains neither a non-empty image_names array nor a board_id. The endpoint requires at least one download target and rejects ambiguous requests before doing any work.","triggerScenarios":"POST /api/v1/images/download with body {image_names: [], board_id: null}, or image_names omitted entirely, or an empty array with no board_id.","commonSituations":"UI state lost so selection was empty when download was clicked; client builds the body conditionally and sends neither field; a filter produced zero selected images.","solutions":["Include at least one image_name in image_names","Or pass a valid board_id to download the whole board","Fix client logic to disable the download action when selection and board are both empty"],"exampleFix":"// before\napi.post('/images/download', { image_names: selected });\n// after\nif (selected.length === 0 && !boardId) return;\napi.post('/images/download', selected.length ? { image_names: selected } : { board_id: boardId });","handlingStrategy":"validation","validationCode":"function canRequestDownload(names, boardId) {\n  return (Array.isArray(names) && names.length > 0) || (typeof boardId === 'string' && boardId.length > 0);\n}\nif (!canRequestDownload(imageNames, boardId)) return; // skip API call","typeGuard":"function hasDownloadTarget(names, boardId): boolean {\n  return (Array.isArray(names) && names.length > 0) || typeof boardId === 'string';\n}","tryCatchPattern":"try {\n  await api.downloadImagesFromList(imageNames, boardId);\n} catch (e) {\n  if (e instanceof ApiError && e.status === 400) {\n    // show 'select images or a board first' in the UI\n  }\n}","preventionTips":["Gate the download button on selection/board state","Never send empty image_names arrays — omit the field or send board_id","Clear stale UI selection state on filter changes","Unit-test the request builder for empty-selection cases"],"tags":["http-400","validation","api"],"backgroundTag":"missing-required-parameter","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}