mastra-ai/mastra · error · HTTPException

Storage is not configured

Error message

Storage is not configured

What it means

This error is thrown by the GET scorer-versions list handler when the Mastra instance has no storage configured. Storage is a prerequisite for the scorer-definitions store, which is where scorer records and versions live. The library throws it as an HTTP 500 because the endpoint is fundamentally unable to serve any data without persistence.

Source

Thrown at packages/server/src/server/handlers/scorer-versions.ts:59

 * GET /stored/scorers/:scorerId/versions - List all versions for a scorer
 */
export const LIST_SCORER_VERSIONS_ROUTE = createRoute({
  method: 'GET',
  path: '/stored/scorers/:scorerId/versions',
  requiresAuth: true,
  responseType: 'json',
  pathParamSchema: scorerVersionPathParams,
  queryParamSchema: listScorerVersionsQuerySchema,
  responseSchema: listScorerVersionsResponseSchema,
  summary: 'List scorer versions',
  description: 'Returns a paginated list of all versions for a stored scorer',
  tags: ['Scorer Versions'],
  handler: async ({ mastra, scorerId, page, perPage, orderBy, 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 scorer = await scorerStore.getById(scorerId);
      if (!scorer) {
        throw new HTTPException(404, { message: `Scorer with id ${scorerId} not found` });
      }
      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));

      const result = await scorerStore.listVersions({
        scorerDefinitionId: scorerId,
        page,
        perPage,
        orderBy,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure storage when constructing Mastra: new Mastra({ storage: new LibSQLStore({ url: process.env.LIBSQL_URL }) })
  2. Verify the storage adapter package is installed and its constructor does not silently fail/return undefined
  3. Check that env vars needed by the storage adapter are set in the server process environment
  4. If the endpoint is intentionally unused, ensure clients do not call scorer-version routes on storage-less deployments

Example fix

// before
new Mastra({ agents: { myAgent } });
// after
import { LibSQLStore } from '@mastra/libsql';
new Mastra({ agents: { myAgent }, storage: new LibSQLStore({ url: process.env.LIBSQL_URL }) });
Defensive patterns

Strategy: validation

Validate before calling

const mastra = getMastra();
if (!mastra.getStorage()) {
  throw new Error('Mastra server requires storage for scorer version APIs');
}

Type guard

function hasStorage(m: Mastra): boolean {
  return typeof m.getStorage === 'function' && m.getStorage() != null;
}

Try / catch

try {
  const res = await fetch(`/api/scorers/${id}/versions`);
  if (!res.ok) throw await res.json();
} catch (e) {
  if (e?.message === 'Storage is not configured') {
    // configure storage / surface config error
  }
}

Prevention

When it happens

Trigger: Calling GET /api/scorers/{scorerId}/versions (list scorer versions) on a Mastra server instance constructed without passing a storage option (Mastra({ storage }) omitted or set to undefined).

Common situations: Running the server in dev with an in-memory Mastra config and no storage adapter (LibSQL/PG/Upstash) configured; deploying after removing storage for a stateless agent-only setup; env var for the storage connection string missing so the storage factory returned undefined.

Related errors


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