{"record":{"id":"8948372aa1d00a1b","repo":"mastra-ai/mastra","slug":"no-workflow-registered-with-id-workflowid-wa","errorCode":null,"errorMessage":"No workflow registered with id \"${workflowId}\". Was it built and saved?","messagePattern":"No workflow registered with id \"(.+?)\"\\. Was it built and saved\\?","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mastracode/sdk/src/workflows/service.ts","lineNumber":114,"sourceCode":"   * emits — used by the `/workflows run` slash handler to render live per-step\n   * progress in the TUI. Non-fatal: errors in the callback are swallowed so a\n   * misbehaving consumer can't take the workflow down.\n   */\n  onEvent?: WorkflowRunEventCallback,\n): Promise<RunResult> {\n  // `getWorkflow` is generic over the statically-registered workflow map, but\n  // stored workflows are registered dynamically at load time — the id is a\n  // runtime value, not a compile-time key. `as never` widens the arg past the\n  // generic constraint; the runtime lookup already validates.\n  let wf: ReturnType<Mastra['getWorkflow']> | undefined;\n  let lookupError: unknown;\n  try {\n    wf = mastra.getWorkflow(workflowId as never);\n  } catch (error) {\n    lookupError = error;\n  }\n  if (!wf) {\n    throw new Error(`No workflow registered with id \"${workflowId}\". Was it built and saved?`, { cause: lookupError });\n  }\n\n  const run = await wf.createRun();\n  if (!onEvent) {\n    return (await run.start({\n      inputData,\n      requestContext: requestContext as Parameters<typeof run.start>[0]['requestContext'],\n    })) as RunResult;\n  }\n\n  const output = run.stream({\n    inputData,\n    requestContext: requestContext as Parameters<typeof run.stream>[0]['requestContext'],\n  }) as unknown as WorkflowRunOutputLike;\n  for await (const event of output.fullStream) {\n    try {\n      onEvent(event);\n    } catch {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/sdk/src/workflows/service.ts#L96-L132","documentation":"runWorkflow first tries mastra.getWorkflow(workflowId); if that throws or returns nothing, no workflow with that id is registered in the instance. The error wraps the original lookup error as cause and hints that the workflow must be built and saved before it can run.","triggerScenarios":"Calling runWorkflow with a workflowId that was never registered (typo), was deleted from storage, or exists in storage with status != 'active' so it isn't loaded at boot.","commonSituations":"Renaming a workflow without updating callers; a workflow build/save step failed earlier leaving no registered id; listing filtered by status:'active' while the workflow is inactive/deleted; running against a different Mastra instance than the one that registered it.","solutions":["Check registered ids with listWorkflows(mastra) and correct the workflowId (typos are the usual cause)","Rebuild and save the workflow so it registers under the expected id","Confirm the workflow's storage row is status 'active'; re-save/activate it if it was deleted or deactivated"],"exampleFix":"// before\nawait runWorkflow(mastra, 'deploy-app', inputData);\n// after\nconst { workflows } = await listWorkflows(mastra);\nconsole.log(workflows.map(w => w.id)); // confirm the exact id first\nawait runWorkflow(mastra, 'deploy-app-v2', inputData);","handlingStrategy":"try-catch","validationCode":"import { listWorkflows } from '.../workflows/service';\nconst { workflows } = await listWorkflows(mastra);\nconst known = new Set(workflows.map(w => w.id));\nif (!known.has(workflowId)) throw new Error(`Unknown workflow \"${workflowId}\". Available: ${[...known].join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  await runWorkflow(mastra, workflowId, inputData);\n} catch (e) {\n  if (String(e.message).startsWith('No workflow registered with id')) {\n    const { workflows } = await listWorkflows(mastra);\n    console.error(`Available workflows: ${workflows.map(w => w.id).join(', ')}`);\n  } else throw e;\n}","preventionTips":["List registered workflow ids (listWorkflows) and validate user input against them before running","Keep workflow ids in constants or a generated registry to avoid typos","Ensure workflows are built and saved with status 'active' before exposing them to runners"],"tags":["workflow","mastra","not-found","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}