mastra-ai/mastra · error · HTTPException
Editor is not configured
Error message
Editor is not configured
What it means
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.
Source
Thrown at packages/server/src/server/handlers/stored-agents.ts:1179
/**
* POST /stored/agents/preview-instructions - Preview resolved instructions
*/
export const PREVIEW_INSTRUCTIONS_ROUTE = createRoute({
method: 'POST',
path: '/stored/agents/preview-instructions',
responseType: 'json',
bodySchema: previewInstructionsBodySchema,
responseSchema: previewInstructionsResponseSchema,
summary: 'Preview resolved instructions',
description:
'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.',
tags: ['Stored Agents'],
requiresAuth: true,
handler: async ({ mastra, blocks, context }) => {
try {
const editor = mastra.getEditor();
if (!editor) {
throw new HTTPException(500, { message: 'Editor is not configured' });
}
const result = await editor.prompt.preview(blocks, context ?? {});
return { result };
} catch (error) {
return handleError(error, 'Error previewing instructions');
}
},
});
View on GitHub (pinned to 75dd419e61)
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.
Example fix
// before
new Mastra({ agents, storage });
// after
import { Editor } from '@mastra/editor';
new Mastra({ agents, storage, editor: new Editor() }); Defensive patterns
Strategy: validation
Validate before calling
const editor = mastra.getEditor();
if (!editor) throw new Error('Editor is not configured; prompt preview is unavailable.'); Type guard
function hasEditor(m: Mastra): boolean {
return typeof m.getEditor === 'function' && !!m.getEditor();
} Try / catch
try {
const preview = await client.previewAgentPrompt(blocks, ctx);
} catch (e) {
if (isMastraServerError(e) && e.status === 500 && e.message.includes('Editor is not configured')) {
// disable preview UI / show setup guidance
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- AcpAgent does not support resuming suspended generate calls
- ACP prompt stopped before completing: ${response.stopReason}
- server.drainTimeout must be a finite number between 0 and 21
- Agents storage domain is not available
- Mastra instance is required for conversations
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/07ec3c55d9b51050.
Report an issue: GitHub.