{"record":{"id":"ccdb659d6fd00264","repo":"invoke-ai/InvokeAI","slug":"video-record-not-found","errorCode":null,"errorMessage":"Video record not found","messagePattern":"Video record not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"invokeai/app/api/routers/videos.py","lineNumber":498,"sourceCode":"    _assert_video_owner(video_name, current_user)\n    try:\n        return ApiDependencies.invoker.services.videos.update(video_name, video_changes)\n    except Exception:\n        raise HTTPException(status_code=400, detail=\"Failed to update video\")\n\n\n@videos_router.get(\"/i/{video_name}\", operation_id=\"get_video_dto\", response_model=VideoDTO)\ndef get_video_dto(\n    current_user: CurrentUserOrDefault,\n    video_name: str = PathParam(description=\"The name of video to get\"),\n) -> VideoDTO:\n    _assert_video_read_access(video_name, current_user)\n    try:\n        return ApiDependencies.invoker.services.videos.get_dto(video_name)\n    except VideoRecordNotFoundException:\n        # See get_image_dto: this is the 404 a workflow's video field drops its reference on,\n        # so only a genuinely missing record may produce it.\n        raise HTTPException(status_code=404)\n\n\n@videos_router.get(\n    \"/i/{video_name}/metadata\", operation_id=\"get_video_metadata\", response_model=Optional[MetadataField]\n)\ndef get_video_metadata(\n    current_user: CurrentUserOrDefault,\n    video_name: str = PathParam(description=\"The name of video to get\"),\n) -> Optional[MetadataField]:\n    _assert_video_read_access(video_name, current_user)\n    try:\n        return ApiDependencies.invoker.services.videos.get_metadata(video_name)\n    except Exception:\n        raise HTTPException(status_code=404)\n\n\n@videos_router.get(\n    \"/i/{video_name}/workflow\", operation_id=\"get_video_workflow\", response_model=WorkflowAndGraphResponse","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/videos.py#L480-L516","documentation":"Raised by get_video_dto (GET videos/i/{video_name}) as a bare HTTP 404 when the service throws VideoRecordNotFoundException. This is the canonical 'video record missing' response — the comment notes it is the 404 a workflow's video field drops its reference on, so only a genuinely missing record may produce it (read-access failures raise earlier, not this). No detail body is attached.","triggerScenarios":"GET videos/i/{video_name} where the video record was deleted (by delete_video, batch delete, or delete_uncategorized_videos), the name is wrong, or the workflow graph still references a video name that no longer exists.","commonSituations":"Workflows or saved graphs referencing videos pruned from the gallery; stale bookmarks/links after cleanup; typos in video_name; restoring a database without its media or vice versa.","solutions":["List current videos (GET videos) and use an existing video_name.","If a workflow references the video, re-link the workflow's video field to an existing video or remove the stale node.","Check whether a concurrent delete (batch/uncategorized cleanup) removed the video and treat the 404 as expected.","Verify the name against the frontend cache after a refresh, not from a stale copy."],"exampleFix":"// before\nconst dto = await api.getVideoDto(name); // throws on missing\n// after\ntry {\n  const dto = await api.getVideoDto(name);\n} catch (e) {\n  if (e.status === 404) return null; // record genuinely gone\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"const videos = await api.listVideos();\nconst exists = videos.some(v => v.video_name === name);\nif (!exists) return null;","typeGuard":null,"tryCatchPattern":"try {\n  return await api.getVideoDto(name);\n} catch (e) {\n  if (e.response?.status === 404) return null; // record genuinely missing\n  throw e;\n}","preventionTips":["Prune workflow references when deleting videos so graphs don't hold stale names.","Re-resolve video names from list endpoints instead of cached/bookmarked values.","Handle 404-with-empty-body explicitly; this endpoint sends no detail string."],"tags":["http-404","rest-api","video","fastapi"],"backgroundTag":"resource-not-found-404","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}