invoke-ai/InvokeAI · error · HTTPException

Workflow not found

Error message

Workflow not found

What it means

HTTP 404 raised by get_workflow when ApiDependencies.invoker.services.workflow_records.get does not find the workflow, i.e. a WorkflowNotFoundError was thrown. InvokeAI converts this typed service error into HTTPException(404, detail='Workflow not found'). It is a precise, typed error unlike the generic 500s elsewhere.

Source

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

workflows_router = APIRouter(prefix="/v1/workflows", tags=["workflows"])


@workflows_router.get(
    "/i/{workflow_id}",
    operation_id="get_workflow",
    responses={
        200: {"model": WorkflowRecordWithThumbnailDTO},
    },
)
def get_workflow(
    current_user: CurrentUserOrDefault,
    workflow_id: str = Path(description="The workflow to get"),
) -> WorkflowRecordWithThumbnailDTO:
    """Gets a workflow"""
    try:
        workflow = ApiDependencies.invoker.services.workflow_records.get(workflow_id)
    except WorkflowNotFoundError:
        raise HTTPException(status_code=404, detail="Workflow not found")

    config = ApiDependencies.invoker.services.configuration
    if config.multiuser:
        is_default = workflow.workflow.meta.category is WorkflowCategory.Default
        is_owner = workflow.user_id == current_user.user_id
        if not (is_default or is_owner or workflow.is_public or current_user.is_admin):
            raise HTTPException(status_code=403, detail="Not authorized to access this workflow")

    thumbnail_url = ApiDependencies.invoker.services.workflow_thumbnails.get_url(workflow_id)
    compatibility = get_workflow_call_compatibility(
        workflow=workflow.workflow.model_dump(),
        workflow_id=workflow.workflow_id,
        services=ApiDependencies.invoker.services,
        user_id=current_user.user_id,
        maximum_children=ApiDependencies.invoker.services.configuration.max_queue_size,
    )
    return WorkflowRecordWithThumbnailDTO(
        thumbnail_url=thumbnail_url,

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. List available workflows (GET /api/v1/workflows) and confirm the workflow_id exists
  2. Re-import the workflow file if the record was deleted
  3. Point the client at the correct installation/data root where the workflow lives
  4. Check you're not confusing workflow id with workflow name in the URL

Example fix

// before
wf = client.get_workflow('my-favorite-workflow')  # id may not exist
// after
ids = [w['workflow_id'] for w in client.list_workflows().items]
if 'my-favorite-workflow' in ids:
    wf = client.get_workflow('my-favorite-workflow')
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm workflow_id exists before fetching
const list = await fetch(`${base}/api/v1/workflows?pages=1&per_page=1000`).then(r => r.json());
if (!list.items.some(w => w.workflow_id === workflowId)) throw new Error(`workflow ${workflowId} not found`);

Try / catch

try {
  const r = await fetch(`${base}/api/v1/workflows/${workflowId}`);
  if (r.status === 404) { console.warn('workflow missing, re-importing'); return null; }
  return await r.json();
} catch (e) { log(e); return null; }

Prevention

When it happens

Trigger: GET /api/v1/workflows/{workflow_id} (and get_image_workflow/get_video_workflow variants) with a workflow_id that has no record in the workflow store.

Common situations: Workflow deleted by another user/session; workflow ID copied from a different InvokeAI installation or database; hardcoded/renamed workflow IDs after re-creating workflows; pointing at a fresh data directory.

Related errors


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