{"record":{"id":"4b9f7b3741f0f423","repo":"mastra-ai/mastra","slug":"processor-id-is-required","errorCode":null,"errorMessage":"Processor ID is required","messagePattern":"Processor ID is required","errorType":"validation","errorClass":"HTTPException","httpStatus":400,"severity":"info","filePath":"packages/server/src/server/handlers/processors.ts","lineNumber":209,"sourceCode":"});\n\nexport const EXECUTE_PROCESSOR_ROUTE = createRoute({\n  method: 'POST',\n  path: '/processors/:processorId/execute',\n  responseType: 'json',\n  pathParamSchema: processorIdPathParams,\n  bodySchema: executeProcessorBodySchema,\n  responseSchema: executeProcessorResponseSchema,\n  summary: 'Execute processor',\n  description: 'Executes a specific processor with the provided input data',\n  tags: ['Processors'],\n  requiresAuth: true,\n  handler: async ({ mastra, processorId, ...bodyParams }) => {\n    try {\n      const { phase, messages } = bodyParams;\n\n      if (!processorId) {\n        throw new HTTPException(400, { message: 'Processor ID is required' });\n      }\n\n      if (!phase) {\n        throw new HTTPException(400, { message: 'Phase is required' });\n      }\n\n      if (!messages || !Array.isArray(messages)) {\n        throw new HTTPException(400, { message: 'Messages array is required' });\n      }\n\n      // Get the processor from Mastra's registered processors\n      let processor;\n      try {\n        processor = mastra.getProcessorById(processorId);\n      } catch {\n        // getProcessorById throws if not found, try by key\n        const processors = mastra.listProcessors() || {};\n        processor = processors[processorId as keyof typeof processors];","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/processors.ts#L191-L227","documentation":"POST /processors/:processorId/execute throws this HTTP 400 when the `processorId` path parameter is missing/empty at handler time. It is a defensive guard even though the route normally enforces the path param via the schema.","triggerScenarios":"Sending POST /processors//execute (empty path segment), or invoking the handler programmatically without a processorId, causing the falsy check `if (!processorId)` to fire.","commonSituations":"Client code builds the URL from an undefined/null variable; an id containing only whitespace; template-string interpolation with an unset value; calling the route handler directly in tests with an incomplete context.","solutions":["Ensure the processor id is set before building the request URL.","Validate the id on the client (non-empty string) before POSTing.","Check the URL template resolves correctly — no double slashes or missing segment."],"exampleFix":"// before\nawait fetch(`/api/processors/${id}/execute`, { method: 'POST', ... });\n// after\nif (!id) throw new Error('processorId is required');\nawait fetch(`/api/processors/${encodeURIComponent(id)}/execute`, { method: 'POST', ... });","handlingStrategy":"validation","validationCode":"if (typeof processorId !== 'string' || processorId.trim() === '') {\n  throw new Error('processorId must be a non-empty string before calling /processors/:id/execute');\n}","typeGuard":"function hasProcessorId(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  const res = await fetch(url, options);\n  if (res.status === 400) {\n    const body = await res.json();\n    if (body.message === 'Processor ID is required') throw new Error('Request mis-built: missing path param');\n  }\n  return await res.json();\n} catch (e) {\n  console.error(e);\n  throw e;\n}","preventionTips":["Build URLs from typed constants, not interpolated possibly-undefined variables.","Validate path params client-side before fetch.","Use encodeURIComponent for ids containing special characters."],"tags":["mastra-server","validation","http-400","bad-request"],"backgroundTag":"missing-required-parameter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}