{"record":{"id":"0059c86a654a17eb","repo":"invoke-ai/InvokeAI","slug":"failed-to-get-video-names","errorCode":null,"errorMessage":"Failed to get video names","messagePattern":"Failed to get video names","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/videos.py","lineNumber":806,"sourceCode":"    \"\"\"\n    # Validate that the caller can read from this board. \"none\" is handled by the SQL layer.\n    if board_id is not None and board_id != \"none\":\n        _assert_board_read_access(board_id, current_user)\n\n    try:\n        return ApiDependencies.invoker.services.videos.get_video_names(\n            starred_first=starred_first,\n            order_dir=order_dir,\n            video_origin=video_origin,\n            categories=categories,\n            is_intermediate=is_intermediate,\n            board_id=board_id,\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 video names\")\n\n\n@videos_router.post(\"/star\", operation_id=\"star_videos_in_list\", response_model=StarredVideosResult)\ndef star_videos_in_list(\n    current_user: CurrentUserOrDefault,\n    batch: VideoNamesBatch,\n) -> StarredVideosResult:\n    # Skip — but do not re-raise — auth failures so a foreign name mid-batch doesn't\n    # discard the response payload for items that were already starred. Mirrors\n    # delete_videos_from_list: re-raising turned partial successes into an error-shaped\n    # response, so the client never invalidated caches for the videos that did change.\n    starred_videos: set[str] = set()\n    failed_videos: set[str] = set()\n    affected_boards: set[str] = set()\n    for video_name in dict.fromkeys(batch.video_names):\n        try:\n            _assert_video_owner(video_name, current_user)\n            updated = ApiDependencies.invoker.services.videos.update(","sourceCodeStart":788,"sourceCodeEnd":824,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/videos.py#L788-L824","documentation":"HTTP 500 raised by get_video_names in the videos router when the gallery/record service throws while listing video names. The handler wraps the service call in try/except Exception and re-raises as HTTPException(500, detail='Failed to get video names'). It is a generic catch-all, so any storage or database fault maps to this message.","triggerScenarios":"GET /api/v1/videos/names with query params like board_id or search_term when the underlying video records service raises (DB error, bad board_id, storage failure).","commonSituations":"Database migration missing or schema mismatch; corrupted/absent video records table; invalid board_id passed as filter; service dependencies not initialized at startup.","solutions":["Check server logs for the original exception before this HTTPException — the detail string hides it","Retry with no filters (omit board_id/search_term) to isolate which query parameter breaks it","Verify database connectivity and that migrations ran (the gallery/video records tables exist)","Restart the app to ensure ApiDependencies services initialized correctly"],"exampleFix":"// before\nresp = requests.get(base + '/api/v1/videos/names', params={'board_id': unknown_board})\n// after\nboards = requests.get(base + '/api/v1/boards/').json()\nif unknown_board in [b['board_id'] for b in boards]:\n    resp = requests.get(base + '/api/v1/videos/names', params={'board_id': unknown_board})","handlingStrategy":"try-catch","validationCode":"// validate board_id filter against existing boards before querying names\nconst boards = await fetch(`${base}/api/v1/boards/`).then(r => r.json());\nif (boardId && !boards.some(b => b.board_id === boardId)) throw new Error('unknown board');","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(`${base}/api/v1/videos/names?${params}`);\n  if (r.status === 500) throw new Error('server failed to list video names; check logs');\n  return await r.json();\n} catch (e) { log(e); return { video_names: [] }; }","preventionTips":["Keep the database migrated and reachable before serving requests","Pass only validated board_id/search_term values as filters","Retry once on 500 before failing — transient DB issues are common"],"tags":["http-500","rest-api","database","invokeai"],"backgroundTag":"internal-server-error-500","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}