{"record":{"id":"07ec3c55d9b51050","repo":"mastra-ai/mastra","slug":"editor-is-not-configured-07ec3c","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/stored-agents.ts","lineNumber":1179,"sourceCode":"/**\n * POST /stored/agents/preview-instructions - Preview resolved instructions\n */\nexport const PREVIEW_INSTRUCTIONS_ROUTE = createRoute({\n  method: 'POST',\n  path: '/stored/agents/preview-instructions',\n  responseType: 'json',\n  bodySchema: previewInstructionsBodySchema,\n  responseSchema: previewInstructionsResponseSchema,\n  summary: 'Preview resolved instructions',\n  description:\n    'Resolves an array of instruction blocks against a request context, evaluating rules, fetching prompt block references, and rendering template variables. Returns the final concatenated instruction string.',\n  tags: ['Stored Agents'],\n  requiresAuth: true,\n  handler: async ({ mastra, blocks, context }) => {\n    try {\n      const editor = mastra.getEditor();\n      if (!editor) {\n        throw new HTTPException(500, { message: 'Editor is not configured' });\n      }\n\n      const result = await editor.prompt.preview(blocks, context ?? {});\n\n      return { result };\n    } catch (error) {\n      return handleError(error, 'Error previewing instructions');\n    }\n  },\n});\n","sourceCodeStart":1161,"sourceCodeEnd":1190,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-agents.ts#L1161-L1190","documentation":"A stored-agents route calls mastra.getEditor() and throws a 500 HTTPException when no editor is configured on the Mastra instance. The editor powers prompt preview/build functionality for stored agents; like storage, it is optional and must be explicitly registered. Without it the preview endpoint cannot run.","triggerScenarios":"POSTing to the editor prompt-preview route (blocks + context body) on a Mastra server whose instance has no editor set, so mastra.getEditor() returns undefined.","commonSituations":"Using the Studio/agent-builder prompt preview before configuring the editor; the editor only wired in certain environments; forgetting the editor option when migrating from a non-editor setup.","solutions":["Configure the editor on your Mastra instance, e.g. new Mastra({ ..., editor: new Editor(...) }) per the agent-builder setup docs.","Confirm the editor package is installed and imported in the server entrypoint.","Check environment gating so the editor is registered in the environment where previews are used.","If the editor is intentionally absent, hide/disable prompt-preview UI paths."],"exampleFix":"// before\nnew Mastra({ agents, storage });\n\n// after\nimport { Editor } from '@mastra/editor';\nnew Mastra({ agents, storage, editor: new Editor() });","handlingStrategy":"validation","validationCode":"const editor = mastra.getEditor();\nif (!editor) throw new Error('Editor is not configured; prompt preview is unavailable.');","typeGuard":"function hasEditor(m: Mastra): boolean {\n  return typeof m.getEditor === 'function' && !!m.getEditor();\n}","tryCatchPattern":"try {\n  const preview = await client.previewAgentPrompt(blocks, ctx);\n} catch (e) {\n  if (isMastraServerError(e) && e.status === 500 && e.message.includes('Editor is not configured')) {\n    // disable preview UI / show setup guidance\n  } else throw e;\n}","preventionTips":["Register the editor on the Mastra instance wherever prompt preview is used.","Check editor availability before rendering preview controls in the UI.","Document editor as an optional-but-required-for-preview dependency."],"tags":["editor","configuration","server","prompt-preview"],"backgroundTag":"feature-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}