invoke-ai/InvokeAI · error · HTTPException

Failed to get video names

Error message

Failed to get video names

What it means

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.

Source

Thrown at invokeai/app/api/routers/videos.py:806

    """
    # Validate that the caller can read from this board. "none" is handled by the SQL layer.
    if board_id is not None and board_id != "none":
        _assert_board_read_access(board_id, current_user)

    try:
        return ApiDependencies.invoker.services.videos.get_video_names(
            starred_first=starred_first,
            order_dir=order_dir,
            video_origin=video_origin,
            categories=categories,
            is_intermediate=is_intermediate,
            board_id=board_id,
            search_term=search_term,
            user_id=current_user.user_id,
            is_admin=current_user.is_admin,
        )
    except Exception:
        raise HTTPException(status_code=500, detail="Failed to get video names")


@videos_router.post("/star", operation_id="star_videos_in_list", response_model=StarredVideosResult)
def star_videos_in_list(
    current_user: CurrentUserOrDefault,
    batch: VideoNamesBatch,
) -> StarredVideosResult:
    # Skip — but do not re-raise — auth failures so a foreign name mid-batch doesn't
    # discard the response payload for items that were already starred. Mirrors
    # delete_videos_from_list: re-raising turned partial successes into an error-shaped
    # response, so the client never invalidated caches for the videos that did change.
    starred_videos: set[str] = set()
    failed_videos: set[str] = set()
    affected_boards: set[str] = set()
    for video_name in dict.fromkeys(batch.video_names):
        try:
            _assert_video_owner(video_name, current_user)
            updated = ApiDependencies.invoker.services.videos.update(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Check server logs for the original exception before this HTTPException — the detail string hides it
  2. Retry with no filters (omit board_id/search_term) to isolate which query parameter breaks it
  3. Verify database connectivity and that migrations ran (the gallery/video records tables exist)
  4. Restart the app to ensure ApiDependencies services initialized correctly

Example fix

// before
resp = requests.get(base + '/api/v1/videos/names', params={'board_id': unknown_board})
// after
boards = requests.get(base + '/api/v1/boards/').json()
if unknown_board in [b['board_id'] for b in boards]:
    resp = requests.get(base + '/api/v1/videos/names', params={'board_id': unknown_board})
Defensive patterns

Strategy: try-catch

Validate before calling

// validate board_id filter against existing boards before querying names
const boards = await fetch(`${base}/api/v1/boards/`).then(r => r.json());
if (boardId && !boards.some(b => b.board_id === boardId)) throw new Error('unknown board');

Try / catch

try {
  const r = await fetch(`${base}/api/v1/videos/names?${params}`);
  if (r.status === 500) throw new Error('server failed to list video names; check logs');
  return await r.json();
} catch (e) { log(e); return { video_names: [] }; }

Prevention

When it happens

Trigger: 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).

Common situations: Database migration missing or schema mismatch; corrupted/absent video records table; invalid board_id passed as filter; service dependencies not initialized at startup.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/0059c86a654a17eb. Report an issue: GitHub.