{"record":{"id":"67fe5d2a68703166","repo":"invoke-ai/InvokeAI","slug":"failed-to-get-image-names-for-date","errorCode":null,"errorMessage":"Failed to get image names for date","messagePattern":"Failed to get image names for date","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/virtual_boards.py","lineNumber":62,"sourceCode":"    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\n    Deprecated: use `GET /v1/gallery/item_names?created_date=<date>`, which covers images and\n    videos in one ordered list.\n    \"\"\"\n    try:\n        return ApiDependencies.invoker.services.image_records.get_image_names_by_date(\n            date=date,\n            starred_first=starred_first,\n            order_dir=order_dir,\n            categories=categories,\n            search_term=search_term,\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 image names for date\")\n\n\n@virtual_boards_router.get(\n    \"/by_date/{date}/item_names\",\n    operation_id=\"list_virtual_board_item_names_by_date\",\n    response_model=GalleryItemNamesResult,\n    deprecated=True,\n)\ndef list_virtual_board_item_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 items 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 items to include\"),\n    search_term: str | None = Query(default=None, description=\"Search term to filter items\"),\n) -> GalleryItemNamesResult:\n    \"\"\"Gets ordered polymorphic (image + video) item refs for a specific date.\n","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/virtual_boards.py#L44-L80","documentation":"HTTP 500 raised by list_virtual_board_image_names_by_date when fetching image names for a specific date fails in the gallery service. Any underlying exception is masked as HTTPException(500, detail='Failed to get image names for date').","triggerScenarios":"GET /api/v1/virtual_boards/by_date/{date}/image_names with an unparseable or out-of-range date, or when the underlying gallery query (categories/search_term filters) raises.","commonSituations":"Malformed date string in the path; filtering by categories that map to no valid column; DB errors on large galleries; timezone-parsing differences causing invalid date objects.","solutions":["Ensure the date path segment is a valid date string (e.g. 2024-01-15) the server can parse","Drop the categories/search_term query params to isolate the failing filter","Check server logs for the original exception to see the service-level cause","Verify gallery DB tables exist and are migrated"],"exampleFix":"// before\nrequests.get(base + '/api/v1/virtual_boards/by_date/2024-13-45/image_names')  # invalid date\n// after\nd = datetime.date(2024, 1, 15).isoformat()\nrequests.get(base + f'/api/v1/virtual_boards/by_date/{d}/image_names')","handlingStrategy":"validation","validationCode":"// validate the date path segment is ISO YYYY-MM-DD before calling\nfunction isValidDate(s) {\n  if (!/^\\d{4}-\\d{2}-\\d{2}$/.test(s)) return false;\n  const d = new Date(s + 'T00:00:00Z');\n  return !isNaN(d.getTime()) && d.toISOString().slice(0, 10) === s;\n}\nif (!isValidDate(date)) throw new Error(`bad date: ${date}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always send normalized ISO dates in the path","Avoid exotic category/search filters until basic queries work","Check server logs for the exception masked by the 500 detail"],"tags":["http-500","rest-api","gallery","date-parsing","invokeai"],"backgroundTag":"internal-server-error-500","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}