{"record":{"id":"23740025d638e0d6","repo":"invoke-ai/InvokeAI","slug":"failed-to-get-virtual-boards-by-date","errorCode":null,"errorMessage":"Failed to get virtual boards by date","messagePattern":"Failed to get virtual boards by date","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/virtual_boards.py","lineNumber":29,"sourceCode":"virtual_boards_router = APIRouter(prefix=\"/v1/virtual_boards\", tags=[\"virtual_boards\"])\n\n\n@virtual_boards_router.get(\n    \"/by_date\",\n    operation_id=\"list_virtual_boards_by_date\",\n    response_model=list[VirtualSubBoardDTO],\n)\ndef list_virtual_boards_by_date(\n    current_user: CurrentUserOrDefault,\n) -> list[VirtualSubBoardDTO]:\n    \"\"\"Gets a list of virtual sub-boards grouped by date. Covers both images and videos.\"\"\"\n    try:\n        return ApiDependencies.invoker.services.gallery.get_dates(\n            user_id=current_user.user_id,\n            is_admin=current_user.is_admin,\n        )\n    except Exception:\n        raise HTTPException(status_code=500, detail=\"Failed to get virtual boards by date\")\n\n\n@virtual_boards_router.get(\n    \"/by_date/{date}/image_names\",\n    operation_id=\"list_virtual_board_image_names_by_date\",\n    response_model=ImageNamesResult,\n    deprecated=True,\n)\ndef list_virtual_board_image_names_by_date(\n    current_user: CurrentUserOrDefault,\n    date: str = Path(description=\"The ISO date string, e.g. '2026-03-18'\"),\n    starred_first: bool = Query(default=True, description=\"Whether to sort starred images first\"),\n    order_dir: SQLiteDirection = Query(default=SQLiteDirection.Descending, description=\"The sort direction\"),\n    categories: list[ImageCategory] | None = Query(default=None, description=\"The categories of images to include\"),\n    search_term: str | None = Query(default=None, description=\"Search term to filter images\"),\n) -> ImageNamesResult:\n    \"\"\"Gets ordered image names for a specific date. Image-only.\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/virtual_boards.py#L11-L47","documentation":"HTTP 500 raised by list_virtual_boards_by_date when the gallery service's get_dates call fails. The route groups gallery images into virtual (implicit) boards by date; any exception in the service becomes HTTPException(500, detail='Failed to get virtual boards by date').","triggerScenarios":"GET /api/v1/virtual_boards/by_date when the gallery records service throws (DB down, schema mismatch, image records unreadable).","commonSituations":"Database not migrated after upgrade; image records table missing or corrupted; multiuser columns (user_id/is_admin filtering) referencing missing schema; DB connection pool exhausted.","solutions":["Check server logs for the original exception before the 500","Verify database migrations have run for the current InvokeAI version","Test DB connectivity directly (psql/sqlite query on the images table)","Restart the service to reinitialize ApiDependencies if a connection pool is stuck"],"exampleFix":"// before\ninvokeai-web  # launched without running migrations after upgrade\n// after\ninvokeai-db-migrate && invokeai-web","handlingStrategy":"retry","validationCode":"// health-check DB-backed endpoints before calling gallery routes\nconst probe = await fetch(`${base}/api/v1/virtual_boards/by_date`);\nif (probe.status === 500) throw new Error('gallery service unavailable; check DB');","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(`${base}/api/v1/virtual_boards/by_date`);\n  if (r.status === 500) return await retryWithBackoff(() => fetch(`${base}/api/v1/virtual_boards/by_date`), 2);\n  return await r.json();\n} catch (e) { log(e); return []; }","preventionTips":["Run database migrations after every InvokeAI upgrade","Monitor DB connectivity from the app host","Restart the service if connection pools appear exhausted"],"tags":["http-500","rest-api","database","gallery","invokeai"],"backgroundTag":"internal-server-error-500","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}