invoke-ai/InvokeAI · error · HTTPException
Unexpected error while getting queue status: {e}
Error message
Unexpected error while getting queue status: {e} What it means
This is a FastAPI HTTPException (500) raised in the GET /session_queue/{queue_id}/status endpoint when any unexpected exception escapes the try block. The service calls session_queue.get_queue_status() and session_processor.get_status(); a failure in either (DB unavailable, serialization error, internal service bug) is wrapped into this generic 500 message with the underlying exception interpolated.
Source
Thrown at invokeai/app/api/routers/session_queue.py:531
200: {"model": SessionQueueAndProcessorStatus},
},
)
def get_queue_status(
current_user: CurrentUserOrDefault,
queue_id: str = Path(description="The queue id to perform this operation on"),
) -> SessionQueueAndProcessorStatus:
"""Gets the status of the session queue. Returns global counts; every user additionally gets
their own pending/in_progress counts (so the UI can show an X/Y badge and scope personal UI
like the progress bar to the user's own activity). Non-admin users cannot see the current
item's identifiers unless they own it."""
try:
queue = ApiDependencies.invoker.services.session_queue.get_queue_status(
queue_id, user_id=current_user.user_id, is_admin=current_user.is_admin
)
processor = ApiDependencies.invoker.services.session_processor.get_status()
return SessionQueueAndProcessorStatus(queue=queue, processor=processor)
except Exception as e:
raise HTTPException(status_code=500, detail=f"Unexpected error while getting queue status: {e}")
@session_queue_router.get(
"/{queue_id}/b/{batch_id}/status",
operation_id="get_batch_status",
responses={
200: {"model": BatchStatus},
},
)
def get_batch_status(
current_user: CurrentUserOrDefault,
queue_id: str = Path(description="The queue id to perform this operation on"),
batch_id: str = Path(description="The batch to get the status of"),
) -> BatchStatus:
"""Gets the status of a batch. Non-admin users only see their own batches."""
try:
user_id = None if current_user.is_admin else current_user.user_id
return ApiDependencies.invoker.services.session_queue.get_batch_status(View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check the server log / detail string for the interpolated underlying exception {e} and fix that root cause first
- Verify the queue database (SQLite file or Postgres) is reachable and migrations have run (invokeai-db-maint / startup migrations)
- Confirm ApiDependencies.invoker.services.session_queue and session_processor are initialized (not None) in your setup
- Restart the API server to re-establish DB connections if it was running during a DB outage
Example fix
// before: endpoint fails with opaque 500 when DB is briefly unavailable
GET /api/v1/session_queue/{queue_id}/status
// after: retry with backoff on the client, or check DB health first
if not await is_db_healthy():
raise HTTPException(status_code=503, detail='Queue storage unavailable') Defensive patterns
Strategy: try-catch
Validate before calling
// client-side pre-check
const res = await fetch('/api/v1/session_queue/health', { method: 'GET' })
if (!res.ok) throw new Error('Queue backend unavailable; skipping status call') Try / catch
try {
const status = await api.get(`/api/v1/session_queue/${queueId}/status`)
} catch (e) {
if (e.response?.status === 500) {
log.error('Queue status failed:', e.response.data?.detail)
// fall back to cached status or retry with backoff
} else throw e
} Prevention
- Keep the queue DB healthy: monitor connection and run migrations on upgrade
- Read the {e} detail in the 500 to identify the true root cause before retrying
- Add retry with exponential backoff for transient DB errors
When it happens
Trigger: Calling GET /api/v1/session_queue/{queue_id}/status when the SessionQueue service throws: the queue DB is down, get_queue_status raises for a corrupted queue row, or session_processor.get_status() fails. Any exception other than the handled ones lands here.
Common situations: SQLite/Postgres connection lost while the server is running; schema migration mismatch after upgrading InvokeAI so the queue tables are missing columns; queue service misconfigured via ApiDependencies (dependency injection not initialized in a custom build).
Related errors
- Unexpected error while canceling by batch id: {e}
- Unexpected error while canceling by destination: {e}
- Unexpected error while clearing queue: {e}
- Unexpected error while pruning queue: {e}
- Unexpected error while getting batch status: {e}
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/12b27d073d9c27b5.
Report an issue: GitHub.