mastra-ai/mastra · error · HTTPException

Processor does not support outputStep phase

Error message

Processor does not support outputStep phase

What it means

For phase 'outputStep' the handler checks that the processor implements processOutputStep (per-step output hook). Missing implementation results in HTTP 400. Like inputStep, this hook only exists on processors designed for the agentic loop.

Source

Thrown at packages/server/src/server/handlers/processors.ts:454

          case 'outputResult':
            if (!processor.processOutputResult) {
              throw new HTTPException(400, { message: 'Processor does not support outputResult phase' });
            }
            result = await processor.processOutputResult({
              ...baseContext,
              state: {},
              result: {
                text: extractTextFromMessages(messages),
                usage: { inputTokens: 0, outputTokens: 0, totalTokens: 0 },
                finishReason: 'unknown',
                steps: [],
              },
            });
            break;

          case 'outputStep':
            if (!processor.processOutputStep) {
              throw new HTTPException(400, { message: 'Processor does not support outputStep phase' });
            }
            result = await processor.processOutputStep({
              ...baseContext,
              systemMessages: [],
              stepNumber: 0,
              steps: [],
              finishReason: 'stop',
              toolCalls: [],
              text: extractTextFromMessages(messages),
              usage: { inputTokens: undefined, outputTokens: undefined, totalTokens: undefined },
            });
            break;

          case 'outputStream':
            // outputStream is for streaming chunks, not a simple execute
            throw new HTTPException(400, {
              message: 'outputStream phase cannot be executed directly. Use streaming instead.',
            });

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Execute an implemented phase instead (e.g. 'output').
  2. Add processOutputStep to the processor class.
  3. Filter available phases per processor in the calling tool.

Example fix

// before
executeProcessor(id, 'outputStep', stepContext);
// after
if ('processOutputStep' in processor) {
  executeProcessor(id, 'outputStep', stepContext);
} else {
  executeProcessor(id, 'output', stepContext);
}
Defensive patterns

Strategy: type-guard

Validate before calling

if (phase === 'outputStep' && !('processOutputStep' in processorRef)) {
  return res.status(400).json({ message: 'Processor lacks outputStep support' });
}

Type guard

function supportsOutputStep(p: any): p is { processOutputStep: Function } {
  return typeof p?.processOutputStep === 'function';
}

Try / catch

try {
  await exec(id, 'outputStep', ctx);
} catch (e) {
  if (e instanceof HTTPException && e.status === 400 && e.message.includes('outputStep')) {
    return; // degrade gracefully: this processor simply has no per-step output hook
  }
  throw e;
}

Prevention

When it happens

Trigger: Executing phase='outputStep' against a processor whose class has no processOutputStep method via the server's processor execute handler.

Common situations: Testing streaming/step processors generically; older processors written before outputStep was introduced; UIs that list all phases uniformly.

Related errors


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