mastra-ai/mastra · error · HTTPException

Processor does not support outputResult phase

Error message

Processor does not support outputResult phase

What it means

For phase 'outputResult' the handler requires the processor to implement processOutputResult (the hook run once on the final model result). If it does not, the server throws HTTP 400. This is a capability check before invocation.

Source

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

            result = await processor.processInputStep({
              ...baseContext,
              systemMessages: [],
              stepNumber: 0,
              steps: [],
              // Pass empty/default values for all inputStep fields
              model: '' as any,
              tools: {},
              toolChoice: undefined,
              activeTools: [],
              providerOptions: undefined,
              modelSettings: undefined,
              structuredOutput: undefined,
            });
            break;

          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({

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a phase the processor implements (inspect the class methods).
  2. Implement processOutputResult on the processor.
  3. Update client code to skip phases the processor does not advertise.

Example fix

// before
await executeProcessor(id, 'outputResult', { messages });
// after
const supported = Object.getOwnPropertyNames(Object.getPrototypeOf(processor));
if (!supported.includes('processOutputResult')) return;
await executeProcessor(id, 'outputResult', { messages });
Defensive patterns

Strategy: type-guard

Validate before calling

const canRun = ['processInput','processInputStep','processOutput','processOutputStep','processOutputResult'].filter(m => typeof (processorRef as any)[m] === 'function');
if (!canRun.includes('processOutputResult')) skip('outputResult');

Type guard

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

Try / catch

try {
  return await exec(id, 'outputResult', ctx);
} catch (e) {
  if (e instanceof HTTPException && e.status === 400 && e.message.includes('outputResult')) {
    return exec(id, 'output', ctx);
  }
  throw e;
}

Prevention

When it happens

Trigger: POSTing phase='outputResult' to the processor execute endpoint for a processor class lacking processOutputResult (e.g. input-only processors).

Common situations: Validating final-output transformations on an input-side processor; test harnesses that run the full phase matrix; processors copied from templates implementing only some hooks.

Related errors


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