invoke-ai/InvokeAI · error · HTTPException

str(e)

Error message

str(e)

What it means

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.

Source

Thrown at invokeai/app/api/routers/workflows.py:300

    config = ApiDependencies.invoker.services.configuration
    if config.multiuser and not current_user.is_admin and existing.user_id != current_user.user_id:
        raise HTTPException(status_code=403, detail="Not authorized to update this workflow")

    if not image.content_type or not image.content_type.startswith("image"):
        raise HTTPException(status_code=415, detail="Not an image")

    contents = await image.read()
    try:
        pil_image = await asyncio.to_thread(Image.open, io.BytesIO(contents))

    except Exception:
        ApiDependencies.invoker.services.logger.error(traceback.format_exc())
        raise HTTPException(status_code=415, detail="Failed to read image")

    try:
        await asyncio.to_thread(ApiDependencies.invoker.services.workflow_thumbnails.save, workflow_id, pil_image)
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))


@workflows_router.delete(
    "/i/{workflow_id}/thumbnail",
    operation_id="delete_workflow_thumbnail",
    responses={
        200: {"model": WorkflowRecordDTO},
    },
)
def delete_workflow_thumbnail(
    current_user: CurrentUserOrDefault,
    workflow_id: str = Path(description="The workflow to update"),
):
    """Removes a workflow's thumbnail image"""
    try:
        existing = ApiDependencies.invoker.services.workflow_records.get(workflow_id)
    except WorkflowNotFoundError:
        raise HTTPException(status_code=404, detail="Workflow not found")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Check InvokeAI server logs for the actual exception text accompanying the 500
  2. Verify disk space and write permissions on the data/thumbnails directory
  3. Shrink the image to a small thumbnail size before uploading
  4. Restart the API server to clear a locked DB/service state, then retry
Defensive patterns

Strategy: retry

Validate before calling

// no reliable client-side precondition; check server health and disk-backed services
const ok = await fetch('/api/v1/system-health').then(r=>r.ok, ()=>false);

Type guard

function isServerError(e) { return e?.status >= 500; }

Try / catch

try { await uploadThumbnail(id, file); } catch (e) { if (isServerError(e)) { log(e.body?.detail); await delay(retry); retryOnce(); } else throw e; }

Prevention

When it happens

Trigger: Any exception from the thumbnail records service during save (filesystem full, unwritable output directory, database lock/error, internal service bug).

Common situations: 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.

Related errors


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