invoke-ai/InvokeAI · error · HTTPException

Failed to get gallery item names for date

Error message

Failed to get gallery item names for date

What it means

HTTP 500 raised by list_virtual_board_item_names_by_date when the gallery item query for a given created_date fails. Like its sibling routes, any exception becomes HTTPException(500, detail='Failed to get gallery item names for date'), hiding the root cause.

Source

Thrown at invokeai/app/api/routers/virtual_boards.py:96

) -> GalleryItemNamesResult:
    """Gets ordered polymorphic (image + video) item refs for a specific date.

    Deprecated: use `GET /v1/gallery/item_names?created_date=<date>`, which returns the same
    order as a flat name list instead of one model per item.
    """
    try:
        return ApiDependencies.invoker.services.gallery.list_item_names(
            starred_first=starred_first,
            order_dir=order_dir,
            categories=categories,
            is_intermediate=False,
            search_term=search_term,
            user_id=current_user.user_id,
            is_admin=current_user.is_admin,
            created_date=date,
        )
    except Exception:
        raise HTTPException(status_code=500, detail="Failed to get gallery item names for date")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Validate the date path segment is a parseable ISO date
  2. Retry without search_term to check whether the search filter is the trigger
  3. Inspect server logs for the pre-HTTPException traceback
  4. Confirm DB health and that gallery item tables are migrated

Example fix

// before
req(base + '/api/v1/virtual_boards/by_date/' + user_date + '/item_names')
// after
if re.fullmatch(r'\d{4}-\d{2}-\d{2}', user_date):
    req(base + f'/api/v1/virtual_boards/by_date/{user_date}/item_names')
Defensive patterns

Strategy: validation

Validate before calling

const dateOk = /^\d{4}-\d{2}-\d{2}$/.test(date);
const searchOk = !searchTerm || searchTerm.length <= 100;
if (!dateOk || !searchOk) throw new Error('invalid date or search_term');

Prevention

When it happens

Trigger: GET /api/v1/virtual_boards/by_date/{date}/item_names when the gallery service query with search_term/user_id/created_date filters raises (DB error, invalid date, bad filter).

Common situations: Invalid or unusual date formats; overly broad search_term causing slow queries/timeouts; multiuser permission columns missing from schema; DB lock or connection failure.

Related errors


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