{"record":{"id":"7c49c6876becbe11","repo":"invoke-ai/InvokeAI","slug":"video-not-found","errorCode":null,"errorMessage":"Video not found","messagePattern":"Video not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"invokeai/app/api/routers/videos.py","lineNumber":177,"sourceCode":"        return\n\n    board_id = ApiDependencies.invoker.services.board_video_records.get_board_for_video(video_name)\n    if board_id is not None:\n        # See `assert_image_read_access`: only a board positively known to be gone may fall\n        # through to a refusal; a lookup that cannot be decided propagates instead of\n        # impersonating a permission decision.\n        try:\n            board = ApiDependencies.invoker.services.board_records.get(board_id)\n        except BoardRecordNotFoundException:\n            pass\n        else:\n            if board.board_visibility in (BoardVisibility.Shared, BoardVisibility.Public):\n                return\n\n    # Gone and denied mean opposite things to a client holding a reference to this video, and\n    # nothing above can tell them apart. See `_assert_image_record_exists`.\n    if not ApiDependencies.invoker.services.video_records.exists(video_name):\n        raise HTTPException(status_code=404, detail=\"Video not found\")\n    raise HTTPException(status_code=403, detail=\"Not authorized to access this video\")\n\n\ndef _is_accepted_video_upload(file: UploadFile) -> bool:\n    if file.content_type and file.content_type.startswith(ACCEPTED_VIDEO_MIME_PREFIXES):\n        return True\n    if file.filename:\n        return file.filename.lower().endswith(ACCEPTED_VIDEO_EXTENSIONS)\n    return False\n\n\ndef _is_mp4_file(path: Path) -> bool:\n    try:\n        with open(path, \"rb\") as video_file:\n            search_limit = min(path.stat().st_size, 64 * 1024)\n            position = 0\n            while position + 8 <= search_limit:\n                video_file.seek(position)","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/videos.py#L159-L195","documentation":"_assert_video_read_access ends by checking video_records.exists(video_name); if the record does not exist it raises HTTP 404 \"Video not found\". Read endpoints (DTO, metadata, workflow, full, thumbnail, urls) funnel through this guard, so a reference to a deleted or never-existing video yields 404 rather than 403, letting clients distinguish gone from denied.","triggerScenarios":"GET /api/v1/videos/{video_name}/... for a video that was deleted, purged from disk, never existed, or whose name is mistyped; also when the video record was removed while the client still held its name.","commonSituations":"Stale gallery references after cleanup jobs; automation scripts caching video names across restarts; DB rebuilds dropping video records; uploading failure that never registered the record.","solutions":["Re-list videos (GET /api/v1/videos/) and use an existing video_name","Re-upload the video if it was deleted or the DB was rebuilt","Fix the mistyped video_name in the calling code","Check the video-record store for the name if the file exists on disk but the API 404s — re-import/scan"],"exampleFix":"# before\nresp = requests.get(f\"{base}/api/v1/videos/{name}/full\")\n# after\nnames = {v[\"video_name\"] for v in requests.get(f\"{base}/api/v1/videos/\").json()}\nif name in names:\n    resp = requests.get(f\"{base}/api/v1/videos/{name}/full\")","handlingStrategy":"validation","validationCode":"names = {v[\"video_name\"] for v in requests.get(f\"{base}/api/v1/videos/\").json()}\nassert video_name in names, f\"video {video_name} does not exist\"","typeGuard":null,"tryCatchPattern":"try:\n    resp = requests.get(f\"{base}/api/v1/videos/{video_name}/full\")\n    resp.raise_for_status()\nexcept requests.HTTPError as e:\n    if e.response.status_code == 404:\n        drop_stale_reference(video_name)","preventionTips":["Purge cached video names when cleanup jobs run","Re-scan/re-import after DB rebuilds","Distinguish 404 (gone) from 403 (denied) in client logic"],"tags":["http-404","video-not-found","api"],"backgroundTag":"resource-not-found","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}