{"record":{"id":"1092b703e3f653cc","repo":"invoke-ai/InvokeAI","slug":"workflow-not-found","errorCode":null,"errorMessage":"Workflow not found","messagePattern":"Workflow not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"invokeai/app/api/routers/workflows.py","lineNumber":47,"sourceCode":"workflows_router = APIRouter(prefix=\"/v1/workflows\", tags=[\"workflows\"])\n\n\n@workflows_router.get(\n    \"/i/{workflow_id}\",\n    operation_id=\"get_workflow\",\n    responses={\n        200: {\"model\": WorkflowRecordWithThumbnailDTO},\n    },\n)\ndef get_workflow(\n    current_user: CurrentUserOrDefault,\n    workflow_id: str = Path(description=\"The workflow to get\"),\n) -> WorkflowRecordWithThumbnailDTO:\n    \"\"\"Gets a workflow\"\"\"\n    try:\n        workflow = ApiDependencies.invoker.services.workflow_records.get(workflow_id)\n    except WorkflowNotFoundError:\n        raise HTTPException(status_code=404, detail=\"Workflow not found\")\n\n    config = ApiDependencies.invoker.services.configuration\n    if config.multiuser:\n        is_default = workflow.workflow.meta.category is WorkflowCategory.Default\n        is_owner = workflow.user_id == current_user.user_id\n        if not (is_default or is_owner or workflow.is_public or current_user.is_admin):\n            raise HTTPException(status_code=403, detail=\"Not authorized to access this workflow\")\n\n    thumbnail_url = ApiDependencies.invoker.services.workflow_thumbnails.get_url(workflow_id)\n    compatibility = get_workflow_call_compatibility(\n        workflow=workflow.workflow.model_dump(),\n        workflow_id=workflow.workflow_id,\n        services=ApiDependencies.invoker.services,\n        user_id=current_user.user_id,\n        maximum_children=ApiDependencies.invoker.services.configuration.max_queue_size,\n    )\n    return WorkflowRecordWithThumbnailDTO(\n        thumbnail_url=thumbnail_url,","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/workflows.py#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List available workflows (GET /api/v1/workflows) and confirm the workflow_id exists","Re-import the workflow file if the record was deleted","Point the client at the correct installation/data root where the workflow lives","Check you're not confusing workflow id with workflow name in the URL"],"exampleFix":"// before\nwf = client.get_workflow('my-favorite-workflow')  # id may not exist\n// after\nids = [w['workflow_id'] for w in client.list_workflows().items]\nif 'my-favorite-workflow' in ids:\n    wf = client.get_workflow('my-favorite-workflow')","handlingStrategy":"try-catch","validationCode":"// confirm workflow_id exists before fetching\nconst list = await fetch(`${base}/api/v1/workflows?pages=1&per_page=1000`).then(r => r.json());\nif (!list.items.some(w => w.workflow_id === workflowId)) throw new Error(`workflow ${workflowId} not found`);","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch(`${base}/api/v1/workflows/${workflowId}`);\n  if (r.status === 404) { console.warn('workflow missing, re-importing'); return null; }\n  return await r.json();\n} catch (e) { log(e); return null; }","preventionTips":["Never hardcode workflow IDs; resolve them from a list call","Re-import workflow files when switching installations or data roots","Distinguish workflow id from workflow name in client code"],"tags":["http-404","rest-api","workflow","invokeai"],"backgroundTag":"resource-not-found-404","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}