mastra-ai/mastra · error · HTTPException

Tool provider connections storage is not configured

Error message

Tool provider connections storage is not configured

What it means

A 500 thrown when the Mastra storage instance has no 'toolProviderConnections' store registered. The handler fails closed because it cannot read or list stored connections without that store. It indicates a missing or incomplete storage configuration rather than a caller mistake.

Source

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

  pathParamSchema: toolProviderConnectionPathParams,
  bodySchema: updateConnectionBodySchema,
  responseSchema: updateConnectionResponseSchema,
  summary: 'Update a connection label',
  description:
    'Updates the persisted display label on tool_provider_connections. Returns 403 when caller is neither the owner nor admin (and the row is not shared), 404 when the row does not exist.',
  tags: ['Tool Providers'],
  requiresAuth: true,
  handler: async ({ mastra, providerId, connectionId, label, requestContext }) => {
    try {
      const editor = requireEditor(mastra.getEditor());
      const provider = await resolveProvider(editor, providerId);
      const callerAuthorId = resolveOwnerId(requestContext, mastra.getLogger());
      const isAdmin = requestContext ? hasAdminBypass(requestContext, TOOL_PROVIDERS_RESOURCE) : false;

      const storage = mastra.getStorage();
      const store = await storage?.getStore('toolProviderConnections');
      if (!store) {
        throw new HTTPException(500, {
          message: 'Tool provider connections storage is not configured',
        });
      }

      const rows = await store.listConnectionsByAuthor({ providerId: provider.info.id });
      const match = rows.find(r => r.connectionId === connectionId);
      if (!match) {
        throw new HTTPException(404, {
          message: `Connection ${connectionId} not found for provider ${providerId}`,
        });
      }

      const isShared = match.scope === 'shared';
      if (!isShared && match.authorId !== callerAuthorId && !isAdmin) {
        throw new HTTPException(403, {
          message: 'You do not have permission to update this connection',
        });
      }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure a storage backend in the Mastra constructor (e.g. LibSQL/Postgres storage instance).
  2. Upgrade @mastra/storage (or your chosen storage adapter) to a version that implements the toolProviderConnections store.
  3. Verify mastra.getStorage() returns the expected instance in your server bootstrap.

Example fix

// before
new Mastra({ agents: [agent] });
// after
import { LibSQLStore } from '@mastra/libsql';
new Mastra({ agents: [agent], storage: new LibSQLStore({ url: process.env.DATABASE_URL! }) });
Defensive patterns

Strategy: validation

Validate before calling

const storage = mastra.getStorage();
const store = storage ? await storage.getStore('toolProviderConnections') : undefined;
if (!store) throw new Error('Server storage does not support toolProviderConnections; configure a storage backend.');

Type guard

function hasToolProviderStore(s: unknown): s is { getStore(name: 'toolProviderConnections'): Promise<unknown | null> } {
  return !!s && typeof (s as any).getStore === 'function';
}

Prevention

When it happens

Trigger: Any tool-provider connection endpoint (e.g. GET connections list, update, disconnect) where mastra.getStorage() returns undefined or storage.getStore('toolProviderConnections') returns null — i.e. Mastra instantiated without a storage backend supporting tool provider connections.

Common situations: Mastra instance created without a storage option (in-memory/no DB setup); storage package version that predates the toolProviderConnections store; storage misconfiguration in mastra/ config after upgrading server but not storage.

Related errors


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