mastra-ai/mastra · error · HTTPException

Scorer definitions storage domain is not available

Error message

Scorer definitions storage domain is not available

What it means

Thrown when storage is configured but `storage.getStore('scorerDefinitions')` returns undefined — the storage adapter does not provide the scorer-definitions domain store. The handler needs this specialized store to run `listResolved`, so it fails fast with HTTP 500.

Source

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

  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;
    } catch (error) {
      return handleError(error, 'Error listing stored scorer definitions');
    }
  },
});

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade the storage adapter package (e.g. @mastra/pg, @mastra/libsql) to a version matching @mastra/core so the scorerDefinitions store is implemented.
  2. Switch to an officially supported adapter known to implement scorer definitions.
  3. If using a custom store, implement the `scorerDefinitions` domain (listResolved/getByIdResolved/create/update/delete).

Example fix

// before
"@mastra/core": "^0.10.0", "@mastra/libsql": "^0.9.0" // mismatched

// after
"@mastra/core": "^0.10.0", "@mastra/libsql": "^0.10.0" // aligned versions
Defensive patterns

Strategy: validation

Validate before calling

const store = await mastra.getStorage()?.getStore('scorerDefinitions');
if (!store) throw new Error('Storage adapter does not implement scorerDefinitions domain.');

Type guard

function hasScorerStore(s: unknown): s is { getStore(d: 'scorerDefinitions'): Promise<object | null> } {
  return typeof (s as any)?.getStore === 'function';
}

Try / catch

try {
  const scorers = await listStoredScorers();
} catch (e) {
  if (String(e).includes('storage domain is not available')) {
    console.error('Upgrade your storage adapter package to support scorer definitions.');
  }
  throw e;
}

Prevention

When it happens

Trigger: GET stored scorers list against a custom or legacy storage adapter that hasn't implemented the `scorerDefinitions` store, or a storage backend version older than the scorer-definitions domain.

Common situations: Using a third-party or community storage adapter that lags behind core; custom storage class overriding getStore and dropping newer domains; upgrading @mastra/core but keeping an old storage package version.

Related errors


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