invoke-ai/InvokeAI · error · HTTPException
Video not found
Error message
Video not found
What it means
_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.
Source
Thrown at invokeai/app/api/routers/videos.py:177
return
board_id = ApiDependencies.invoker.services.board_video_records.get_board_for_video(video_name)
if board_id is not None:
# See `assert_image_read_access`: only a board positively known to be gone may fall
# through to a refusal; a lookup that cannot be decided propagates instead of
# impersonating a permission decision.
try:
board = ApiDependencies.invoker.services.board_records.get(board_id)
except BoardRecordNotFoundException:
pass
else:
if board.board_visibility in (BoardVisibility.Shared, BoardVisibility.Public):
return
# Gone and denied mean opposite things to a client holding a reference to this video, and
# nothing above can tell them apart. See `_assert_image_record_exists`.
if not ApiDependencies.invoker.services.video_records.exists(video_name):
raise HTTPException(status_code=404, detail="Video not found")
raise HTTPException(status_code=403, detail="Not authorized to access this video")
def _is_accepted_video_upload(file: UploadFile) -> bool:
if file.content_type and file.content_type.startswith(ACCEPTED_VIDEO_MIME_PREFIXES):
return True
if file.filename:
return file.filename.lower().endswith(ACCEPTED_VIDEO_EXTENSIONS)
return False
def _is_mp4_file(path: Path) -> bool:
try:
with open(path, "rb") as video_file:
search_limit = min(path.stat().st_size, 64 * 1024)
position = 0
while position + 8 <= search_limit:
video_file.seek(position)View on GitHub (pinned to 0b6a024f2f)
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
Example fix
# before
resp = requests.get(f"{base}/api/v1/videos/{name}/full")
# after
names = {v["video_name"] for v in requests.get(f"{base}/api/v1/videos/").json()}
if name in names:
resp = requests.get(f"{base}/api/v1/videos/{name}/full") Defensive patterns
Strategy: validation
Validate before calling
names = {v["video_name"] for v in requests.get(f"{base}/api/v1/videos/").json()}
assert video_name in names, f"video {video_name} does not exist" Try / catch
try:
resp = requests.get(f"{base}/api/v1/videos/{video_name}/full")
resp.raise_for_status()
except requests.HTTPError as e:
if e.response.status_code == 404:
drop_stale_reference(video_name) Prevention
- Purge cached video names when cleanup jobs run
- Re-scan/re-import after DB rebuilds
- Distinguish 404 (gone) from 403 (denied) in client logic
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/7c49c6876becbe11.
Report an issue: GitHub.