{"record":{"id":"c73a594242348e0d","repo":"mastra-ai/mastra","slug":"workflow-workflowid-not-found","errorCode":null,"errorMessage":"Workflow ${workflowId} not found","messagePattern":"Workflow (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client-sdks/ai-sdk/src/workflow-route.ts","lineNumber":116,"sourceCode":"  includeTextStreamParts = true,\n  sendReasoning = false,\n  sendSources = false,\n}: WorkflowStreamHandlerOptions): Promise<SupportedUIMessageStream> {\n  const {\n    runId,\n    resourceId: resourceIdFromParams,\n    inputData,\n    initialState,\n    resumeData,\n    requestContext,\n    ...rest\n  } = params;\n  const resourceIdFromContext = requestContext?.get(MASTRA_RESOURCE_ID_KEY) as string | undefined;\n  const resourceId = resourceIdFromContext ?? resourceIdFromParams;\n\n  const workflowObj = mastra.getWorkflowById(workflowId);\n  if (!workflowObj) {\n    throw new Error(`Workflow ${workflowId} not found`);\n  }\n\n  const run = await workflowObj.createRun({ runId, resourceId, ...rest });\n\n  const stream = resumeData\n    ? run.resumeStream({ resumeData, ...rest, requestContext })\n    : run.stream({ inputData, initialState, ...rest, requestContext });\n\n  if (version === 'v7') {\n    return createUIMessageStreamV7<V7UIMessage>({\n      execute: async ({ writer }) => {\n        for await (const part of toAISdkStream(stream, {\n          from: 'workflow',\n          version: 'v7',\n          includeTextStreamParts,\n          sendReasoning,\n          sendSources,\n        })) {","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/client-sdks/ai-sdk/src/workflow-route.ts#L98-L134","documentation":"handleWorkflowStream looks up the workflow by ID via mastra.getWorkflowById(workflowId) before creating a run. When no workflow is registered under that ID, this error is thrown — the server has no workflow bound to the requested identifier.","triggerScenarios":"Calling the workflow stream endpoint (stream/uiMessageStream client methods) with a workflowId that is not registered on the Mastra instance, e.g. mastra.getWorkflowById('myFlow') returning undefined.","commonSituations":"Typo in the workflow ID between client and server registration; workflow defined but forgotten in the workflows map passed to new Mastra({...}); registration happening after server startup or behind an env-gated config that skipped it; calling across packages where the workflow lives in another Mastra instance.","solutions":["Verify the workflowId string matches exactly the key used at registration.","Register the workflow: new Mastra({ workflows: { myWorkflow: myWorkflow } }).","Confirm the server process was restarted after adding the workflow.","Check env/feature flags that conditionally include the workflow in the Mastra config.","Ensure the client and server point at the same Mastra deployment/instance."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: { weatherAgent } });\nclient.getWorkflowStream('dataPipeline', ...);\n// after\nexport const mastra = new Mastra({ agents: { weatherAgent }, workflows: { dataPipeline } });\nclient.getWorkflowStream('dataPipeline', ...);","handlingStrategy":"try-catch","validationCode":"const workflows = mastra.listWorkflows();\nif (!(workflowId in workflows)) {\n  throw new Error(`Workflow '${workflowId}' not registered. Available: ${Object.keys(workflows).join(', ')}`);\n}","typeGuard":"function isRegisteredWorkflow(mastra: Mastra, id: string): boolean {\n  return id in mastra.listWorkflows();\n}","tryCatchPattern":"try {\n  const stream = await client.getWorkflowStream(workflowId, ...);\n} catch (e) {\n  if (e instanceof Error && /Workflow .* not found/.test(e.message)) {\n    console.error(`Workflow '${workflowId}' missing on server. Check registration in new Mastra({ workflows: {...} })`);\n  } else throw e;\n}","preventionTips":["Keep workflow IDs in a shared constants module used by both server registration and client calls.","List registered workflows at server startup and log them.","Verify registration is not gated behind env flags that differ between environments."],"tags":["workflow","registration","client-sdk","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}