{"record":{"id":"71d07142e647de8d","repo":"mastra-ai/mastra","slug":"mastra-get-processor-by-id-not-found","errorCode":"MASTRA_GET_PROCESSOR_BY_ID_NOT_FOUND","errorMessage":"Processor with id ${id} not found","messagePattern":"Processor with id (.+?) not found","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/mastra/index.ts","lineNumber":4412,"sourceCode":"   *\n   * @example\n   * ```typescript\n   * const mastra = new Mastra({\n   *   processors: {\n   *     validator: validatorProcessor\n   *   }\n   * });\n   *\n   * const processor = mastra.getProcessorById('validator-processor-id');\n   * ```\n   */\n  public getProcessorById<TProcessorName extends keyof TProcessors>(\n    id: TProcessors[TProcessorName]['id'],\n  ): TProcessors[TProcessorName] {\n    const allProcessors = this.#processors;\n\n    if (!allProcessors) {\n      throw new MastraError({\n        id: 'MASTRA_GET_PROCESSOR_BY_ID_NOT_FOUND',\n        domain: ErrorDomain.MASTRA,\n        category: ErrorCategory.USER,\n        text: `Processor with id ${id} not found`,\n      });\n    }\n\n    // First try to find by internal ID\n    for (const processor of Object.values(allProcessors)) {\n      if (processor.id === id) {\n        return processor as TProcessors[TProcessorName];\n      }\n    }\n\n    // Fallback to searching by registration key\n    const processorByKey = allProcessors[id];\n    if (processorByKey) {\n      return processorByKey as TProcessors[TProcessorName];","sourceCodeStart":4394,"sourceCodeEnd":4430,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/mastra/index.ts#L4394-L4430","documentation":"getProcessorById reads the internal processor registry (#processors) and throws this MastraError when it is empty/undefined. Unlike the by-id prompt-block error, this one fires only when no processors are registered at all — a lookup against a missing collection.","triggerScenarios":"Calling mastra.getProcessorById(id) on a Mastra instance constructed without processors and without any later processor registration.","commonSituations":"Runtime/tooling code assuming processors were configured on the instance; building a Mastra instance for inference only (no processors) while a helper still queries them; config gating that skips processor registration in some environments.","solutions":["Register processors (constructor config or the register API) before querying by id.","Check the processors listing accessor for emptiness before calling getProcessorById.","Ensure the code path constructing Mastra in the current environment actually registers processors.","Catch this error where an empty processor set is acceptable and treat it as 'no processor'."],"exampleFix":"// before\nconst mastra = new Mastra({ agents });\nconst p = mastra.getProcessorById('pii-redactor'); // throws: no processors registered\n// after\nconst mastra = new Mastra({ agents, processors: { piiRedactor } });\nconst p = mastra.getProcessorById('piiRedactor');","handlingStrategy":"try-catch","validationCode":"const procs = mastra.getProcessors?.();\nif (!procs || Object.keys(procs).length === 0) {\n  throw new Error('No processors registered on this Mastra instance');\n}","typeGuard":null,"tryCatchPattern":"try {\n  const processor = mastra.getProcessorById(id);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'MASTRA_GET_PROCESSOR_BY_ID_NOT_FOUND') {\n    // empty registry: continue without the processor\n  } else throw e;\n}","preventionTips":["Register processors in the same constructor/config path that constructs Mastra.","Assert at startup that required processor ids exist.","Avoid environment-conditional registration that silently omits processors."],"tags":["lookup-failed","processors","empty-registry"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}