invoke-ai/InvokeAI · error · HTTPException

Unexpected error while pausing queue: {e}

Error message

Unexpected error while pausing queue: {e}

What it means

Mirror of error 146 for the pause endpoint (PUT /{queue_id}/processor/pause, admin only): any exception from SessionProcessor.pause() is converted into a 500 whose detail includes the exception text. Thrown when the processor cannot be paused, typically due to unexpected internal state rather than a modeled client error.

Source

Thrown at invokeai/app/api/routers/session_queue.py:291

        return ApiDependencies.invoker.services.session_processor.resume()
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Unexpected error while resuming queue: {e}")


@session_queue_router.put(
    "/{queue_id}/processor/pause",
    operation_id="pause",
    responses={200: {"model": SessionProcessorStatus}},
)
def pause(
    current_user: AdminUserOrDefault,
    queue_id: str = Path(description="The queue id to perform this operation on"),
) -> SessionProcessorStatus:
    """Pauses session processor. Admin only."""
    try:
        return ApiDependencies.invoker.services.session_processor.pause()
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Unexpected error while pausing queue: {e}")


@session_queue_router.put(
    "/{queue_id}/cancel_all_except_current",
    operation_id="cancel_all_except_current",
    responses={200: {"model": CancelAllExceptCurrentResult}},
)
def cancel_all_except_current(
    current_user: CurrentUserOrDefault,
    queue_id: str = Path(description="The queue id to perform this operation on"),
) -> CancelAllExceptCurrentResult:
    """Immediately cancels all queue items except in-processing items. Non-admin users can only cancel their own items."""
    try:
        # Admin users can cancel all items, non-admin users can only cancel their own
        user_id = None if current_user.is_admin else current_user.user_id
        return ApiDependencies.invoker.services.session_queue.cancel_all_except_current(
            queue_id=queue_id, user_id=user_id
        )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Inspect the embedded exception message in the detail
  2. Check processor status first; skip pause if already paused/stopped
  3. Restart the app if the processor state is inconsistent after a crash
  4. Avoid concurrent pause/resume from multiple clients
Defensive patterns

Strategy: validation

Validate before calling

const s = await (await fetch('/api/v1/queue/default/processor/status')).json();
if (!s.is_started || s.status === 'paused') console.log('pause unnecessary');

Type guard

function canPause(s) { return !!s && s.is_started === true && s.status !== 'paused'; }

Try / catch

try {
  const res = await fetch('/api/v1/queue/default/processor/pause', {method:'PUT'});
  if (res.status === 500) console.error('pause failed:', (await res.json()).detail);
} catch (e) { console.error('network error during pause:', e); }

Prevention

When it happens

Trigger: Pausing while the processor is mid-transition, before it is started, or when the internal pause routine throws.

Common situations: Race between pause and resume calls from an admin UI and a script; processor not yet initialized at app startup; queue processor crash leaving state inconsistent.

Related errors


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