mastra-ai/mastra · warning · TripWire
Aborted by processor
Error message
Aborted by processor
What it means
An input processor invoked a processor's processInput and the processor called abort(), which throws a TripWire. When no reason string is passed, the default message 'Aborted by processor' is used. The middleware catches the TripWire and stores it in providerOptions for wrapGenerate/wrapStream to surface as a controlled abort rather than a crash.
Source
Thrown at client-sdks/ai-sdk/src/middleware.ts:505
messageList.add(msg, 'input');
}
}
const originalInputCount = params.prompt.filter(msg => msg.role !== 'system').length;
// Run each input processor
for (const processor of inputProcessors) {
if (processor.processInput) {
try {
// Processors modify messageList in place. Array returns are supported
// but the messageList reference takes precedence for preserving source info.
await processor.processInput({
messages: messageList.get.input.db(),
systemMessages: messageList.getSystemMessages(),
messageList,
requestContext,
abort: (reason?: string): never => {
throw new TripWire(reason || 'Aborted by processor');
},
} as ProcessInputArgs);
} catch (error) {
if (error instanceof TripWire) {
// Store tripwire in providerOptions for wrapGenerate/wrapStream to handle
return {
...params,
providerOptions: {
...params.providerOptions,
mastraProcessors: {
tripwire: true,
reason: error.message,
} satisfies ProcessorMiddlewareState,
},
};
}
throw error;
}View on GitHub (pinned to 75dd419e61)
Solutions
- Inspect the registered input processors to see which one tripped
- Call abort('your reason') inside the processor to get a meaningful message
- Adjust the processor's thresholds/rules if it trips incorrectly
- Handle the TripWire result in wrapGenerate/wrapStream output (it surfaces as text/error content)
Example fix
// before
abort();
// after
abort('Input blocked by moderation policy'); Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
import { TripWire } from '@mastra/core';
try {
await processor.processInput({ ...args, abort: (r) => { throw new TripWire(r || 'Aborted by processor'); } });
} catch (e) {
if (e instanceof TripWire) {
console.warn('Input aborted by processor:', e.message);
// surface a controlled response instead of failing hard
} else throw e;
} Prevention
- Always pass a descriptive reason to abort() in processors
- Log which processor aborted (wrap processInput with try/catch per processor)
- Test moderation/guardrail processors against realistic inputs before deploy
When it happens
Trigger: A registered input processor decides the request must stop (e.g. moderation filter, secret scrubbing) and calls abort() without a custom reason string.
Common situations: Deploying guardrail/moderation processors that trip on sensitive content; users surprised that generation halted; assuming the message would include a custom reason but none was provided.
Related errors
- TokenLimiterProcessor: System messages alone exceed token li
- TokenLimiterProcessor: No messages fit within the remaining
- Tripwire triggered by ${processor.id}
- Tripwire triggered in workflow ${workflow.id}
- Stream part blocked by ${processor.id}
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/8605a2b798d6c05e.
Report an issue: GitHub.