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 the 'scorerDefinitions' domain store is unavailable via storage.getStore('scorerDefinitions'). This means the configured storage adapter either does not implement the scorer-definitions domain or its store failed to initialize. It surfaces as HTTP 500 because the handler cannot proceed without the domain store.

Source

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

  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,
      });

      return result;
    } catch (error) {
      return handleError(error, 'Error listing scorer versions');

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade the storage adapter package to a version that implements the scorerDefinitions domain store
  2. If using custom storage, implement/return a store for the 'scorerDefinitions' domain in getStore
  3. Run any pending storage migrations/init so all domain tables are created
  4. Switch to a supported adapter (LibSQLStore, PgStore, UpstashStore) from a current release

Example fix

// before (custom storage)
async getStore(domain: StorageDomains) { if (domain === 'scorerDefinitions') return null; ... }
// after
async getStore(domain: StorageDomains) { if (domain === 'scorerDefinitions') return this.scorerDefinitionsStore; ... }
Defensive patterns

Strategy: validation

Validate before calling

const storage = mastra.getStorage();
if (!storage || !(await storage.getStore('scorerDefinitions'))) {
  throw new Error('Storage adapter does not support scorerDefinitions domain');
}

Type guard

async function supportsScorerDefs(s: MastraStorage): Promise<boolean> {
  return (await s.getStore('scorerDefinitions')) != null;
}

Try / catch

try {
  await createScorerVersion(id, payload);
} catch (e) {
  if (e?.message?.includes('storage domain is not available')) {
    // upgrade/implement the storage adapter
  }
  throw e;
}

Prevention

When it happens

Trigger: Any scorer-version route (list, create version, get version) when mastra.getStorage() returns an object whose getStore('scorerDefinitions') resolves to null/undefined — e.g. an old storage adapter without scorer support, or a custom storage implementation that does not register the scorerDefinitions domain.

Common situations: Using an outdated @mastra/libsql/@mastra/pg version that predates scorer-definition stores; implementing a custom MastraStorage subclass without overriding the scorerDefinitions store; a storage migration step that did not run so the store is not provisioned.

Related errors


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