mastra-ai/mastra · error · MastraError
AGENT_INPUT_PROCESSOR_ERROR
AGENT_INPUT_PROCESSOR_ERROR
Error message
[Agent:${this.name}] - Input processor error What it means
A MastraError (id AGENT_INPUT_PROCESSOR_ERROR, category USER) thrown when an input processor attached to the agent throws during processing of the inbound request. The agent wraps the processor's own error with agent name, processorId, and retry details, attributing the failure to user-supplied processor logic rather than core library code.
Solutions
- Read `error.details.processorId` and `reason` to find the failing processor, then fix or harden that processor's code
- Add try/catch inside the processor and return a fallback result or throw a descriptive error with actionable `options` (e.g. retry)
- If the processor is optional, remove it from the agent's inputProcessors config or make it no-op on failure
- Check processor API compatibility with your @mastra/core version
Example fix
// before
const processor = { processInput: async ({ messages }) => callModerationApi(messages) };
// after
const processor = { processInput: async ({ messages }) => {
try { return await callModerationApi(messages); }
catch (e) { console.warn('moderation unavailable, skipping', e); return { messages };
} }; Defensive patterns
Strategy: try-catch
Type guard
function isInputProcessorError(e) {
return e instanceof Error && 'id' in e && e.id === 'AGENT_INPUT_PROCESSOR_ERROR';
} Try / catch
try {
await agent.generate(prompt, opts);
} catch (e) {
if (e?.id === 'AGENT_INPUT_PROCESSOR_ERROR') {
logger.error(`processor ${e.details.processorId} failed: ${e.details.reason}`);
return fallbackResponse();
}
throw e;
} Prevention
- Wrap external calls inside every input processor in try/catch with an explicit fallback
- Log and alert on processor failures with processorId
- Keep processors pure/cheap; push flaky network work behind retries
- Test processors against malformed input before deploying
When it happens
Trigger: Any `agent.generate()`/`stream()`/`loop()` call where a registered InputProcessor's `processInput` (or similar) callback throws, and the failure is not recoverable via the processor's retry options.
Common situations: Custom input processors that call external services which are down; processors validating prompts that throw on malformed input; processors written against an older processor API shape; throws inside async processor code not caught by the processor itself.
Related errors
- AGENT_INPUT_STEP_PROCESSOR_ERROR
- Agent ' ' (key: ' ') must have a non-empty description to…
- Agent " " not found
- AGENT_DELEGATION_HOOK_FAILED
- AGENT_DURABLE_METHOD_NOT_AVAILABLE
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/13a591ed72a48dbe.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/src/agent/agent.ts:4279
});
try {
messageList = await runner.runInputProcessors(messageList, observabilityContext, requestContext, 0);
} catch (error) {
if (error instanceof TripWire) {
tripwire = {
reason: error.message,
retry: error.options?.retry,
metadata: error.options?.metadata,
processorId: error.processorId,
};
this.logger.warn('Input processor tripwire triggered', {
agent: this.name,
reason: error.message,
processorId: error.processorId,
retry: error.options?.retry,
});
} else {
throw new MastraError(
{
id: 'AGENT_INPUT_PROCESSOR_ERROR',
domain: ErrorDomain.AGENT,
category: ErrorCategory.USER,
text: `[Agent:${this.name}] - Input processor error`,
},
error,
);
}
}
}
return {
messageList,
tripwire,
};
}
View on GitHub (pinned to 75dd419e61)