{"record":{"id":"fb160f7010c3ccfc","repo":"mastra-ai/mastra","slug":"processor-workflow-failed","errorCode":"PROCESSOR_WORKFLOW_FAILED","errorMessage":"Processor workflow ${workflow.id} failed with status: ${result.status}${detailStr}","messagePattern":"Processor workflow (.+?) failed with status: (.+?)(.+?)","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/processors/runner.ts","lineNumber":610,"sourceCode":"      );\n    }\n\n    // Check for execution failure\n    if (result.status !== 'success') {\n      // Collect error details from the workflow result and failed steps\n      const details: string[] = [];\n      if (result.status === 'failed') {\n        if (result.error) {\n          details.push(result.error.message || JSON.stringify(result.error));\n        }\n        for (const [stepId, step] of Object.entries(result.steps)) {\n          if (step.status === 'failed' && step.error?.message) {\n            details.push(`step ${stepId}: ${step.error.message}`);\n          }\n        }\n      }\n      const detailStr = details.length > 0 ? ` — ${details.join('; ')}` : '';\n      throw new MastraError({\n        category: 'USER',\n        domain: 'AGENT',\n        id: 'PROCESSOR_WORKFLOW_FAILED',\n        text: `Processor workflow ${workflow.id} failed with status: ${result.status}${detailStr}`,\n      });\n    }\n\n    // Extract and validate the output from the workflow result\n    const output = result.result;\n\n    if (!output || typeof output !== 'object') {\n      // No output means no changes - return input unchanged\n      return input;\n    }\n\n    // Validate it has the expected ProcessorStepOutput shape\n    if (!('phase' in output) || !('messages' in output || 'part' in output || 'messageList' in output)) {\n      throw new MastraError({","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/processors/runner.ts#L592-L628","documentation":"After a processor sub-workflow completes, executeWorkflowAsProcessor checks the run result status; anything other than success/tripwire (typically 'failed') raises a MastraError with id PROCESSOR_WORKFLOW_FAILED, category USER, domain AGENT. Per-step error messages are appended after the em dash for diagnosis.","triggerScenarios":"runOutputProcessors / runInputProcessors / runProcessOutputStep / runProcessToolResult runs a workflow as a processor and result.status is 'failed' — an inner step threw (bad input data, schema validation failure, unhandled exception, tool error).","commonSituations":"Sub-workflow input doesn't match its input schema; a step's tool/API call failed; suspend/resume state mishandled; nondeterministic external dependency inside the workflow failing at runtime.","solutions":["Read the appended details ('step <id>: <error.message>') and fix the failing inner step indicated there.","Validate inputData against the workflow's input schema before executing it as a processor.","Add error handling/retries inside the sub-workflow steps for flaky external calls.","Log result.status and per-step errors on the workflow result to reproduce the failure in isolation."],"exampleFix":"// before\nmastra.getWorkflow('wf').execute({ inputData: partial });\n// after\nconst parsed = wf.inputSchema.parse(partial);\nawait wf.execute({ inputData: parsed });","handlingStrategy":"validation","validationCode":"const parsed = wf.inputSchema.safeParse(inputData);\nif (!parsed.success) throw new Error(`Workflow input invalid: ${parsed.error.message}`);","typeGuard":null,"tryCatchPattern":"try {\n  await runProcessors(input);\n} catch (e) {\n  if (e?.id === 'PROCESSOR_WORKFLOW_FAILED') {\n    // details after '—' name the failing step; fix or retry that step\n  } else throw e;\n}","preventionTips":["Validate workflow input against its schema before execution.","Add try/catch and retries inside flaky workflow steps.","Log per-step errors from the workflow result in development."],"tags":["workflows","processors","mastra-error","workflow-failed"],"backgroundTag":"workflow-step-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}