{"record":{"id":"0f385e70fe44dfb8","repo":"invoke-ai/InvokeAI","slug":"str-e-0f385e","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"invokeai/app/api/routers/workflows.py","lineNumber":300,"sourceCode":"    config = ApiDependencies.invoker.services.configuration\n    if config.multiuser and not current_user.is_admin and existing.user_id != current_user.user_id:\n        raise HTTPException(status_code=403, detail=\"Not authorized to update this workflow\")\n\n    if not image.content_type or not image.content_type.startswith(\"image\"):\n        raise HTTPException(status_code=415, detail=\"Not an image\")\n\n    contents = await image.read()\n    try:\n        pil_image = await asyncio.to_thread(Image.open, io.BytesIO(contents))\n\n    except Exception:\n        ApiDependencies.invoker.services.logger.error(traceback.format_exc())\n        raise HTTPException(status_code=415, detail=\"Failed to read image\")\n\n    try:\n        await asyncio.to_thread(ApiDependencies.invoker.services.workflow_thumbnails.save, workflow_id, pil_image)\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=str(e))\n\n\n@workflows_router.delete(\n    \"/i/{workflow_id}/thumbnail\",\n    operation_id=\"delete_workflow_thumbnail\",\n    responses={\n        200: {\"model\": WorkflowRecordDTO},\n    },\n)\ndef delete_workflow_thumbnail(\n    current_user: CurrentUserOrDefault,\n    workflow_id: str = Path(description=\"The workflow to update\"),\n):\n    \"\"\"Removes a workflow's thumbnail image\"\"\"\n    try:\n        existing = ApiDependencies.invoker.services.workflow_records.get(workflow_id)\n    except WorkflowNotFoundError:\n        raise HTTPException(status_code=404, detail=\"Workflow not found\")","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/workflows.py#L282-L318","documentation":"HTTP 500 whose detail is str(e) — raised when workflow_thumbnails.save() throws while persisting the decoded thumbnail for the workflow. The raw exception text is passed through, indicating an unexpected server-side storage failure rather than a client error.","triggerScenarios":"Any exception from the thumbnail records service during save (filesystem full, unwritable output directory, database lock/error, internal service bug).","commonSituations":"Disk-quota exhaustion on the InvokeAI data volume; permission errors on the thumbnails directory after migration; SQLite locked by a concurrent long transaction; oversized images blowing memory limits.","solutions":["Check InvokeAI server logs for the actual exception text accompanying the 500","Verify disk space and write permissions on the data/thumbnails directory","Shrink the image to a small thumbnail size before uploading","Restart the API server to clear a locked DB/service state, then retry"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// no reliable client-side precondition; check server health and disk-backed services\nconst ok = await fetch('/api/v1/system-health').then(r=>r.ok, ()=>false);","typeGuard":"function isServerError(e) { return e?.status >= 500; }","tryCatchPattern":"try { await uploadThumbnail(id, file); } catch (e) { if (isServerError(e)) { log(e.body?.detail); await delay(retry); retryOnce(); } else throw e; }","preventionTips":["Monitor disk space and permissions on the InvokeAI data directory","Keep uploaded thumbnails small (resize client-side) to reduce storage failures","Alert on 500s and correlate with server logs for the underlying exception"],"tags":["http-500","thumbnail","storage","server-error"],"backgroundTag":"internal-server-error","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}