{"record":{"id":"13a591ed72a48dbe","repo":"mastra-ai/mastra","slug":"agent-input-processor-error","errorCode":"AGENT_INPUT_PROCESSOR_ERROR","errorMessage":"[Agent:${this.name}] - Input processor error","messagePattern":"\\[Agent:(.+?)\\] - Input processor error","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/agent/agent.ts","lineNumber":4279,"sourceCode":"      });\n      try {\n        messageList = await runner.runInputProcessors(messageList, observabilityContext, requestContext, 0);\n      } catch (error) {\n        if (error instanceof TripWire) {\n          tripwire = {\n            reason: error.message,\n            retry: error.options?.retry,\n            metadata: error.options?.metadata,\n            processorId: error.processorId,\n          };\n          this.logger.warn('Input processor tripwire triggered', {\n            agent: this.name,\n            reason: error.message,\n            processorId: error.processorId,\n            retry: error.options?.retry,\n          });\n        } else {\n          throw new MastraError(\n            {\n              id: 'AGENT_INPUT_PROCESSOR_ERROR',\n              domain: ErrorDomain.AGENT,\n              category: ErrorCategory.USER,\n              text: `[Agent:${this.name}] - Input processor error`,\n            },\n            error,\n          );\n        }\n      }\n    }\n\n    return {\n      messageList,\n      tripwire,\n    };\n  }\n","sourceCodeStart":4261,"sourceCodeEnd":4297,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/agent/agent.ts#L4261-L4297","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nconst processor = { processInput: async ({ messages }) => callModerationApi(messages) };\n// after\nconst processor = { processInput: async ({ messages }) => {\n  try { return await callModerationApi(messages); }\n  catch (e) { console.warn('moderation unavailable, skipping', e); return { messages };\n} };","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isInputProcessorError(e) {\n  return e instanceof Error && 'id' in e && e.id === 'AGENT_INPUT_PROCESSOR_ERROR';\n}","tryCatchPattern":"try {\n  await agent.generate(prompt, opts);\n} catch (e) {\n  if (e?.id === 'AGENT_INPUT_PROCESSOR_ERROR') {\n    logger.error(`processor ${e.details.processorId} failed: ${e.details.reason}`);\n    return fallbackResponse();\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["agent","input-processor","user-code","mastra-error"],"backgroundTag":"custom-processor-threw","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}