mastra-ai/mastra · error · HTTPException

Storage is not configured

Error message

Storage is not configured

What it means

The list stored scorers handler calls `mastra.getStorage()` and throws HTTP 500 when it returns undefined. Mastra server routes that read persisted data require a storage adapter to be configured on the Mastra instance; without one there is nowhere to read scorer definitions from.

Source

Thrown at packages/server/src/server/handlers/stored-scorers.ts:54

/**
 * GET /stored/scorers - List all stored scorer definitions
 */
export const LIST_STORED_SCORERS_ROUTE = createRoute({
  method: 'GET',
  path: '/stored/scorers',
  responseType: 'json',
  queryParamSchema: listStoredScorersQuerySchema,
  responseSchema: listStoredScorersResponseSchema,
  summary: 'List stored scorer definitions',
  description: 'Returns a paginated list of all scorer definitions stored in the database',
  tags: ['Stored Scorers'],
  requiresAuth: true,
  handler: async ({ mastra, page, perPage, orderBy, status, authorId, metadata, requestContext }) => {
    try {
      const storage = mastra.getStorage();

      if (!storage) {
        throw new HTTPException(500, { message: 'Storage is not configured' });
      }

      const scorerStore = await storage.getStore('scorerDefinitions');
      if (!scorerStore) {
        throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });
      }

      const scope = await getStoredResourceScope(mastra, requestContext);
      const result = await scorerStore.listResolved({
        page,
        perPage,
        orderBy,
        status,
        authorId,
        metadata: scopeStoredResourceMetadata(metadata, scope),
      });

      return result;

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure a storage adapter on the Mastra instance, e.g. `new Mastra({ storage: new MastraStorage(...) })` or the Postgres/Upstress/LibSQL adapter of your choice.
  2. If using @mastra/core with a deployer, set the storage via env-backed config so the served instance has it.
  3. Restart the server after adding storage and confirm the Studio scorers page loads.

Example fix

// before
new Mastra({ agents: { myAgent } });

// after
import { Mastra } from '@mastra/core';
import { PostgresStore } from '@mastra/pg';
new Mastra({ agents: { myAgent }, storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }) });
Defensive patterns

Strategy: validation

Validate before calling

if (!mastra.getStorage()) {
  throw new Error('Mastra storage is not configured; scorers endpoints are unavailable.');
}

Try / catch

try {
  const res = await fetch('/api/stored-scorers');
  if (!res.ok) throw new Error(await res.text());
} catch (e) {
  console.error('Storage misconfiguration on server:', e);
}

Prevention

When it happens

Trigger: GET request to the stored scorers list endpoint on a Mastra instance constructed without a `storage` option — e.g. `new Mastra({ agents })` with no storage adapter, or storage intentionally omitted in a stateless deployment.

Common situations: Fresh project following agent-only quickstart (no storage configured) then opening Studio scorers page; storage removed during a refactor; running the server against an in-memory-only setup that lacks persistent storage.

Related errors


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