invoke-ai/InvokeAI · error · HTTPException
Unexpected error while listing all queue items: {e}
Error message
Unexpected error while listing all queue items: {e} What it means
Catch-all in the list_all_queue_items endpoint: any failure while fetching the full queue item list (or sanitizing items per-user) becomes a 500 whose detail carries the underlying exception text. Thrown because the router treats all service-layer failures identically rather than mapping known errors (e.g. InvalidQueueIDError) to 4xx responses.
Source
Thrown at invokeai/app/api/routers/session_queue.py:165
responses={
200: {"model": list[SessionQueueItem]},
},
)
def list_all_queue_items(
current_user: CurrentUserOrDefault,
queue_id: str = Path(description="The queue id to perform this operation on"),
destination: Optional[str] = Query(default=None, description="The destination of queue items to fetch"),
) -> list[SessionQueueItem]:
"""Gets all queue items"""
try:
items = ApiDependencies.invoker.services.session_queue.list_all_queue_items(
queue_id=queue_id,
destination=destination,
)
# Sanitize items for non-admin users
return [sanitize_queue_item_for_user(item, current_user.user_id, current_user.is_admin) for item in items]
except Exception as e:
raise HTTPException(status_code=500, detail=f"Unexpected error while listing all queue items: {e}")
@session_queue_router.get(
"/{queue_id}/item_ids",
operation_id="get_queue_item_ids",
responses={
200: {"model": ItemIdsResult},
},
)
def get_queue_item_ids(
current_user: CurrentUserOrDefault,
queue_id: str = Path(description="The queue id to perform this operation on"),
order_dir: SQLiteDirection = Query(default=SQLiteDirection.Descending, description="The order of sort"),
) -> ItemIdsResult:
"""Gets all queue item ids that match the given parameters.
IDs for every user's items are returned (item ids carry no sensitive data on their own).
When the corresponding items are hydrated via get_queue_items_by_item_ids, those belongingView on GitHub (pinned to 0b6a024f2f)
Solutions
- Inspect the detail string - it contains the underlying exception; address that specific cause
- Confirm queue_id matches a queue on the running instance
- If it happens with multiuser enabled, check stored queue items for malformed data the sanitizer cannot handle
- Retry under lighter DB load or after restarting if SQLite lock contention is suspected
Defensive patterns
Strategy: try-catch
Validate before calling
const q = await fetch(`/api/v1/queue/${queueId}`);
if (!q.ok) throw new Error(`Unknown queue_id: ${queueId}`); Type guard
function isQueueItemList(v) { return Array.isArray(v) && v.every(i => i && typeof i === 'object' && 'item_id' in i); } Try / catch
try {
const res = await fetch(`/api/v1/queue/${queueId}/list_all`);
if (!res.ok) { console.error('list_all failed:', (await res.json()).detail); return []; }
return await res.json();
} catch { return []; } Prevention
- Use the same instance's queue ids you created the work on
- Reduce polling frequency to avoid SQLite contention under load
- In multiuser mode, watch for sanitizer failures on legacy data
- Log the detail string - it contains the actual exception
When it happens
Trigger: GET /{queue_id}/list_all (optionally with destination param) when the queue service raises - nonexistent queue_id, DB query failure, or an exception raised during sanitize_queue_item_for_user on a malformed stored item.
Common situations: Polling a queue id from a different InvokeAI instance than the one serving the request; multiuser setups where a stored item lacks fields the sanitizer expects; transient SQLite locking under heavy queue load.
Related errors
- Unexpected error while enqueuing batch: {e}
- Unexpected error while listing all queue item ids: {e}
- Failed to get queue items
- Failed to get queue item summaries
- Unexpected error while resuming queue: {e}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/39181994f127a332.
Report an issue: GitHub.