{"record":{"id":"b4b558ae4797b75a","repo":"invoke-ai/InvokeAI","slug":"video-thumbnail-not-found","errorCode":null,"errorMessage":"Video thumbnail not found","messagePattern":"Video thumbnail not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"info","filePath":"invokeai/app/api/routers/videos.py","lineNumber":704,"sourceCode":"@videos_router.get(\n    \"/i/{video_name}/thumbnail\",\n    operation_id=\"get_video_thumbnail\",\n    response_class=Response,\n    responses={\n        200: {\"description\": \"Return the video thumbnail\", \"content\": {\"image/webp\": {}}},\n        404: {\"description\": \"Video not found\"},\n    },\n)\ndef get_video_thumbnail(\n    current_user: CurrentMediaUserOrDefault,\n    video_name: str = PathParam(description=\"The name of thumbnail file to get\"),\n) -> Response:\n    \"\"\"Returns the first-frame WebP thumbnail of an authorized video.\"\"\"\n    _assert_video_read_access(video_name, current_user)\n    try:\n        path = ApiDependencies.invoker.services.videos.get_path(video_name, thumbnail=True)\n    except Exception:\n        raise HTTPException(status_code=404)\n    try:\n        with open(path, \"rb\") as thumbnail_file:\n            thumbnail = thumbnail_file.read()\n    except OSError:\n        raise HTTPException(status_code=404)\n\n    return Response(\n        thumbnail,\n        media_type=\"image/webp\",\n        headers={\"Cache-Control\": _get_video_cache_control()},\n    )\n\n\n@videos_router.get(\"/i/{video_name}/urls\", operation_id=\"get_video_urls\", response_model=VideoUrlsDTO)\ndef get_video_urls(\n    current_user: CurrentUserOrDefault,\n    video_name: str = PathParam(description=\"The name of the video whose URL to get\"),\n) -> VideoUrlsDTO:","sourceCodeStart":686,"sourceCodeEnd":722,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/videos.py#L686-L722","documentation":"Raised by get_video_thumbnail as HTTP 404 when videos.get_path(video_name, thumbnail=True) throws — i.e. no thumbnail path could be resolved for the video. Typically the video record doesn't exist, or a first-frame thumbnail was never generated for it. The handler catches Exception broadly, so service errors also surface as this 404.","triggerScenarios":"Requesting the WebP thumbnail of a nonexistent/deleted video; a video whose thumbnail was never generated (imported externally, generation failed); path-resolution service error.","commonSituations":"Gallery grids loading thumbnails for items deleted concurrently; videos uploaded without server-side thumbnail generation; DB restore where thumbnail files were pruned.","solutions":["Fall back to a placeholder image in the UI when the thumbnail 404s instead of retrying.","Verify the video exists via the DTO endpoint; if it does but the thumbnail 404s, the thumbnail is missing — regenerate or accept fallback.","Check server logs for the underlying path-resolution exception.","Ensure the thumbnails directory exists and is writable on the server."],"exampleFix":"// before\nimg.src = `/api/v1/videos/i/${name}/thumbnail`; // broken image icon on 404\n// after\nimg.onerror = () => { img.src = PLACEHOLDER_WEBP; };\nimg.src = `/api/v1/videos/i/${name}/thumbnail`;","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"img.onerror = () => { img.src = PLACEHOLDER; }; // 404 on thumbnail falls back to placeholder","preventionTips":["Always provide a placeholder thumbnail in gallery UIs.","Don't hard-fail galleries when one thumbnail 404s; continue loading others.","Ensure thumbnail generation runs for every ingested video."],"tags":["http-404","thumbnail","video","media"],"backgroundTag":"resource-not-found-404","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}