{"record":{"id":"774ff9abaad55b01","repo":"invoke-ai/InvokeAI","slug":"unexpected-error-while-resuming-queue-e","errorCode":null,"errorMessage":"Unexpected error while resuming queue: {e}","messagePattern":"Unexpected error while resuming queue: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/session_queue.py","lineNumber":275,"sourceCode":"        return [sanitize_queue_item_for_user(item, current_user.user_id, current_user.is_admin) for item in summaries]\n    except Exception:\n        raise HTTPException(status_code=500, detail=\"Failed to get queue item summaries\")\n\n\n@session_queue_router.put(\n    \"/{queue_id}/processor/resume\",\n    operation_id=\"resume\",\n    responses={200: {\"model\": SessionProcessorStatus}},\n)\ndef resume(\n    current_user: AdminUserOrDefault,\n    queue_id: str = Path(description=\"The queue id to perform this operation on\"),\n) -> SessionProcessorStatus:\n    \"\"\"Resumes session processor. Admin only.\"\"\"\n    try:\n        return ApiDependencies.invoker.services.session_processor.resume()\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Unexpected error while resuming queue: {e}\")\n\n\n@session_queue_router.put(\n    \"/{queue_id}/processor/pause\",\n    operation_id=\"pause\",\n    responses={200: {\"model\": SessionProcessorStatus}},\n)\ndef pause(\n    current_user: AdminUserOrDefault,\n    queue_id: str = Path(description=\"The queue id to perform this operation on\"),\n) -> SessionProcessorStatus:\n    \"\"\"Pauses session processor. Admin only.\"\"\"\n    try:\n        return ApiDependencies.invoker.services.session_processor.pause()\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Unexpected error while pausing queue: {e}\")\n\n","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/session_queue.py#L257-L293","documentation":"Thrown by the resume endpoint (PUT /{queue_id}/processor/resume, admin only): any exception from SessionProcessor.resume() is wrapped as a 500 with the exception message embedded. It means the queue processor could not be transitioned back to running for an unanticipated reason (the endpoint doesn't model processor-state conflicts as 4xx).","triggerScenarios":"Resuming when the session processor service is in an unexpected state, is not started, or an internal error occurs in the processor's resume path.","commonSituations":"Calling resume concurrently from multiple admin sessions; invoking before the queue processor thread/service has fully initialized after startup; stale UI holding an old processor state.","solutions":["Read detail - it contains the underlying exception message","Check GET /{queue_id}/processor/status; if already running, resume is unnecessary - skip it","Retry after the app finishes startup (processor initialized)","Serialize admin processor operations to avoid concurrent resume/pause races"],"exampleFix":"// before: blind resume\nawait fetch(`/api/v1/queue/default/processor/resume`, {method: 'PUT'});\n// after: check state first\nconst s = await (await fetch('/api/v1/queue/default/processor/status')).json();\nif (!s.is_started || s.status === 'paused') await fetch('/api/v1/queue/default/processor/resume', {method: 'PUT'});","handlingStrategy":"validation","validationCode":"const s = await (await fetch('/api/v1/queue/default/processor/status')).json();\nif (s.is_started && s.status !== 'paused') console.log('processor already running; resume unnecessary');","typeGuard":"function isProcessorRunning(s) { return s !== null && typeof s === 'object' && s.is_started === true && s.status === 'idle' || s.status === 'processing'; }","tryCatchPattern":"try {\n  const res = await fetch('/api/v1/queue/default/processor/resume', {method:'PUT'});\n  if (res.status === 500) console.error('resume failed:', (await res.json()).detail);\n} catch (e) { console.error('network error during resume:', e); }","preventionTips":["Check processor status before resume to make the call idempotent","Wait for app startup to complete before issuing processor commands","Ensure the caller has admin rights in multiuser mode","Serialize processor operations across clients"],"tags":["fastapi","http-500","queue","processor","api"],"backgroundTag":"api-internal-server-error","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}