{"record":{"id":"24c2a2787360c61a","repo":"mastra-ai/mastra","slug":"editor-is-not-configured-24c2a2","errorCode":null,"errorMessage":"Editor is not configured","messagePattern":"Editor is not configured","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"packages/server/src/server/handlers/tool-providers.ts","lineNumber":74,"sourceCode":" * Lazily import `@mastra/core/tool-provider` so this server module can evaluate\n * under any peer-compatible core. The new value exports (`UnknownToolProviderError`,\n * `SHARED_BUCKET_ID`) ship in core `>=1.39.0-0`; users on older cores who never\n * configure a `MastraEditor` short-circuit via `requireEditor` long before this\n * runs. ESM caches one module instance per resolved specifier so the\n * `instanceof` check below sees the same class identity that `@mastra/editor`\n * throws.\n */\nlet _toolProviderModule: typeof ToolProviderModule | undefined;\nasync function loadToolProviderModule() {\n  if (!_toolProviderModule) {\n    _toolProviderModule = await import('@mastra/core/tool-provider');\n  }\n  return _toolProviderModule;\n}\n\nfunction requireEditor(editor: IMastraEditor | undefined): IMastraEditor {\n  if (!editor) {\n    throw new HTTPException(500, { message: 'Editor is not configured' });\n  }\n  return editor;\n}\n\nasync function resolveProvider(editor: IMastraEditor, providerId: string): Promise<ToolProvider> {\n  try {\n    return editor.getToolProviderOrThrow(providerId);\n  } catch (error) {\n    const { UnknownToolProviderError } = await loadToolProviderModule();\n    if (error instanceof UnknownToolProviderError) {\n      throw new HTTPException(404, { message: error.message });\n    }\n    throw error;\n  }\n}\n\n// Emit a single warn per process when the connection-owner fallback fires.\n// Multi-tenant deployments that forget to wire `mapUserToResourceId` (or","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/tool-providers.ts#L56-L92","documentation":"The tool-providers handler depends on an IMastraEditor instance; requireEditor throws HTTPException 500 when the editor is undefined, meaning the Mastra instance was created without editor support or the tool-provider module was never wired. The endpoints cannot resolve or mutate tool providers without it.","triggerScenarios":"Calling tool-provider routes on a server whose Mastra instance has no editor configured (mastra.getEditor()/equivalent returns undefined), so requireEditor(editor) receives undefined.","commonSituations":"Running a server build without the editor feature/package; forgetting to pass editor options in Mastra config; accessing tool-provider UI endpoints in a minimal/headless deployment.","solutions":["Configure the editor on the Mastra instance (pass the editor implementation when constructing Mastra).","Install/enable the editor package so the tool-provider module can be resolved (getToolProviderModule() no longer returns undefined).","Disable or avoid tool-provider routes in deployments that intentionally omit the editor."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents, storage });\n// after\nimport { MastraEditor } from '@mastra/editor';\nexport const mastra = new Mastra({ agents, storage, editor: new MastraEditor({ /* config */ }) });","handlingStrategy":"validation","validationCode":"const editor = mastra.getEditor?.();\nif (!editor) {\n  throw new Error('Tool-provider routes require an editor; pass editor when constructing Mastra');\n}","typeGuard":"function hasEditor(mastra: Mastra): mastra is Mastra & { getEditor(): IMastraEditor } {\n  return typeof (mastra as any).getEditor === 'function' && (mastra as any).getEditor() != null;\n}","tryCatchPattern":"try {\n  const providers = await client.listToolProviders();\n} catch (e) {\n  if (e.status === 500 && /Editor is not configured/.test(e.message)) {\n    throw new Error('Enable the editor package on this server to use tool providers.');\n  }\n  throw e;\n}","preventionTips":["Install and configure the editor package wherever tool-provider routes are exposed.","Hide tool-provider UI/features when the editor is absent.","Assert editor presence in server bootstrap checks."],"tags":["http-500","configuration","editor","missing-config"],"backgroundTag":"service-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}