invoke-ai/InvokeAI · error · HTTPException
Failed to get virtual boards by date
Error message
Failed to get virtual boards by date
What it means
HTTP 500 raised by list_virtual_boards_by_date when the gallery service's get_dates call fails. The route groups gallery images into virtual (implicit) boards by date; any exception in the service becomes HTTPException(500, detail='Failed to get virtual boards by date').
Source
Thrown at invokeai/app/api/routers/virtual_boards.py:29
virtual_boards_router = APIRouter(prefix="/v1/virtual_boards", tags=["virtual_boards"])
@virtual_boards_router.get(
"/by_date",
operation_id="list_virtual_boards_by_date",
response_model=list[VirtualSubBoardDTO],
)
def list_virtual_boards_by_date(
current_user: CurrentUserOrDefault,
) -> list[VirtualSubBoardDTO]:
"""Gets a list of virtual sub-boards grouped by date. Covers both images and videos."""
try:
return ApiDependencies.invoker.services.gallery.get_dates(
user_id=current_user.user_id,
is_admin=current_user.is_admin,
)
except Exception:
raise HTTPException(status_code=500, detail="Failed to get virtual boards by date")
@virtual_boards_router.get(
"/by_date/{date}/image_names",
operation_id="list_virtual_board_image_names_by_date",
response_model=ImageNamesResult,
deprecated=True,
)
def list_virtual_board_image_names_by_date(
current_user: CurrentUserOrDefault,
date: str = Path(description="The ISO date string, e.g. '2026-03-18'"),
starred_first: bool = Query(default=True, description="Whether to sort starred images first"),
order_dir: SQLiteDirection = Query(default=SQLiteDirection.Descending, description="The sort direction"),
categories: list[ImageCategory] | None = Query(default=None, description="The categories of images to include"),
search_term: str | None = Query(default=None, description="Search term to filter images"),
) -> ImageNamesResult:
"""Gets ordered image names for a specific date. Image-only.
View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check server logs for the original exception before the 500
- Verify database migrations have run for the current InvokeAI version
- Test DB connectivity directly (psql/sqlite query on the images table)
- Restart the service to reinitialize ApiDependencies if a connection pool is stuck
Example fix
// before invokeai-web # launched without running migrations after upgrade // after invokeai-db-migrate && invokeai-web
Defensive patterns
Strategy: retry
Validate before calling
// health-check DB-backed endpoints before calling gallery routes
const probe = await fetch(`${base}/api/v1/virtual_boards/by_date`);
if (probe.status === 500) throw new Error('gallery service unavailable; check DB'); Try / catch
try {
const r = await fetch(`${base}/api/v1/virtual_boards/by_date`);
if (r.status === 500) return await retryWithBackoff(() => fetch(`${base}/api/v1/virtual_boards/by_date`), 2);
return await r.json();
} catch (e) { log(e); return []; } Prevention
- Run database migrations after every InvokeAI upgrade
- Monitor DB connectivity from the app host
- Restart the service if connection pools appear exhausted
When it happens
Trigger: GET /api/v1/virtual_boards/by_date when the gallery records service throws (DB down, schema mismatch, image records unreadable).
Common situations: Database not migrated after upgrade; image records table missing or corrupted; multiuser columns (user_id/is_admin filtering) referencing missing schema; DB connection pool exhausted.
Related errors
- Failed to get video names
- Failed to get image names for date
- Failed to get gallery item names for date
- Failed to remove image from board
- Failed to add video to board
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/23740025d638e0d6.
Report an issue: GitHub.