mastra-ai/mastra · error · HTTPException

Editor is not configured

Error message

Editor is not configured

What it means

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.

Source

Thrown at packages/server/src/server/handlers/tool-providers.ts:74

 * Lazily import `@mastra/core/tool-provider` so this server module can evaluate
 * under any peer-compatible core. The new value exports (`UnknownToolProviderError`,
 * `SHARED_BUCKET_ID`) ship in core `>=1.39.0-0`; users on older cores who never
 * configure a `MastraEditor` short-circuit via `requireEditor` long before this
 * runs. ESM caches one module instance per resolved specifier so the
 * `instanceof` check below sees the same class identity that `@mastra/editor`
 * throws.
 */
let _toolProviderModule: typeof ToolProviderModule | undefined;
async function loadToolProviderModule() {
  if (!_toolProviderModule) {
    _toolProviderModule = await import('@mastra/core/tool-provider');
  }
  return _toolProviderModule;
}

function requireEditor(editor: IMastraEditor | undefined): IMastraEditor {
  if (!editor) {
    throw new HTTPException(500, { message: 'Editor is not configured' });
  }
  return editor;
}

async function resolveProvider(editor: IMastraEditor, providerId: string): Promise<ToolProvider> {
  try {
    return editor.getToolProviderOrThrow(providerId);
  } catch (error) {
    const { UnknownToolProviderError } = await loadToolProviderModule();
    if (error instanceof UnknownToolProviderError) {
      throw new HTTPException(404, { message: error.message });
    }
    throw error;
  }
}

// Emit a single warn per process when the connection-owner fallback fires.
// Multi-tenant deployments that forget to wire `mapUserToResourceId` (or

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure the editor on the Mastra instance (pass the editor implementation when constructing Mastra).
  2. Install/enable the editor package so the tool-provider module can be resolved (getToolProviderModule() no longer returns undefined).
  3. Disable or avoid tool-provider routes in deployments that intentionally omit the editor.

Example fix

// before
export const mastra = new Mastra({ agents, storage });
// after
import { MastraEditor } from '@mastra/editor';
export const mastra = new Mastra({ agents, storage, editor: new MastraEditor({ /* config */ }) });
Defensive patterns

Strategy: validation

Validate before calling

const editor = mastra.getEditor?.();
if (!editor) {
  throw new Error('Tool-provider routes require an editor; pass editor when constructing Mastra');
}

Type guard

function hasEditor(mastra: Mastra): mastra is Mastra & { getEditor(): IMastraEditor } {
  return typeof (mastra as any).getEditor === 'function' && (mastra as any).getEditor() != null;
}

Try / catch

try {
  const providers = await client.listToolProviders();
} catch (e) {
  if (e.status === 500 && /Editor is not configured/.test(e.message)) {
    throw new Error('Enable the editor package on this server to use tool providers.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling tool-provider routes on a server whose Mastra instance has no editor configured (mastra.getEditor()/equivalent returns undefined), so requireEditor(editor) receives undefined.

Common situations: 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.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/24c2a2787360c61a. Report an issue: GitHub.