mastra-ai/mastra · error · MastraError

PROCESSOR_WORKFLOW_FAILED

PROCESSOR_WORKFLOW_FAILED

Error message

Processor workflow ${workflow.id} failed with status: ${result.status}${detailStr}

What it means

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.

Source

Thrown at packages/core/src/processors/runner.ts:610

      );
    }

    // Check for execution failure
    if (result.status !== 'success') {
      // Collect error details from the workflow result and failed steps
      const details: string[] = [];
      if (result.status === 'failed') {
        if (result.error) {
          details.push(result.error.message || JSON.stringify(result.error));
        }
        for (const [stepId, step] of Object.entries(result.steps)) {
          if (step.status === 'failed' && step.error?.message) {
            details.push(`step ${stepId}: ${step.error.message}`);
          }
        }
      }
      const detailStr = details.length > 0 ? ` — ${details.join('; ')}` : '';
      throw new MastraError({
        category: 'USER',
        domain: 'AGENT',
        id: 'PROCESSOR_WORKFLOW_FAILED',
        text: `Processor workflow ${workflow.id} failed with status: ${result.status}${detailStr}`,
      });
    }

    // Extract and validate the output from the workflow result
    const output = result.result;

    if (!output || typeof output !== 'object') {
      // No output means no changes - return input unchanged
      return input;
    }

    // Validate it has the expected ProcessorStepOutput shape
    if (!('phase' in output) || !('messages' in output || 'part' in output || 'messageList' in output)) {
      throw new MastraError({

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Read the appended details ('step <id>: <error.message>') and fix the failing inner step indicated there.
  2. Validate inputData against the workflow's input schema before executing it as a processor.
  3. Add error handling/retries inside the sub-workflow steps for flaky external calls.
  4. Log result.status and per-step errors on the workflow result to reproduce the failure in isolation.

Example fix

// before
mastra.getWorkflow('wf').execute({ inputData: partial });
// after
const parsed = wf.inputSchema.parse(partial);
await wf.execute({ inputData: parsed });
Defensive patterns

Strategy: validation

Validate before calling

const parsed = wf.inputSchema.safeParse(inputData);
if (!parsed.success) throw new Error(`Workflow input invalid: ${parsed.error.message}`);

Try / catch

try {
  await runProcessors(input);
} catch (e) {
  if (e?.id === 'PROCESSOR_WORKFLOW_FAILED') {
    // details after '—' name the failing step; fix or retry that step
  } else throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/fb160f7010c3ccfc. Report an issue: GitHub.