mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED

Error message

This storage provider does not support getting scores by ID

What it means

getScoreById in the observability storage base throws by default because fetching a single score record by ID is an optional provider capability. Throwing this MastraError signals the configured storage adapter never overrode the method. It is a deliberate capability gap, not data corruption.

Source

Thrown at packages/core/src/storage/domains/observability/base.ts:605

  }

  /**
   * Retrieves a list of scores with optional filtering.
   */
  async listScores(_args: ListScoresArgs): Promise<ListScoresResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_LIST_SCORES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support listing scores',
    });
  }

  /**
   * Retrieves a single score by its score ID.
   */
  async getScoreById(_scoreId: string): Promise<ScoreRecord | null> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support getting scores by ID',
    });
  }

  async getScoreAggregate(_args: GetScoreAggregateArgs): Promise<GetScoreAggregateResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support score aggregation',
    });
  }

  async getScoreBreakdown(_args: GetScoreBreakdownArgs): Promise<GetScoreBreakdownResponse> {
    throw new MastraError({

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Use a storage provider that implements score reads (libsql, postgres, upstash, etc.).
  2. Override getScoreById in your custom adapter with a real lookup returning ScoreRecord | null.
  3. Guard the call with try/catch and handle the unsupported case (return null / disable detail view).
  4. Verify the adapter package version matches @mastra/core so the method is implemented.

Example fix

// before
const score = await storage.getScoreById(scoreId); // throws on minimal adapter
// after
try {
  const score = await storage.getScoreById(scoreId);
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED') {
    return null;
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const supportsGetScoreById = storage.constructor.prototype.hasOwnProperty('getScoreById');
if (!supportsGetScoreById) return null;

Type guard

function canGetScoreById(s: any): boolean {
  return typeof s?.getScoreById === 'function' && s.constructor.prototype.hasOwnProperty('getScoreById');
}

Try / catch

try {
  return await storage.getScoreById(scoreId);
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED') return null;
  throw e;
}

Prevention

When it happens

Trigger: Calling storage.getScoreById('<scoreId>') on an adapter that extends the base observability domain without implementing getScoreById — e.g. a custom minimal store or an in-house provider that only persists traces.

Common situations: Custom storage adapters written against an older base class; playground/score detail pages pointed at a provider lacking score reads; tests swapping in a stub storage implementation.

Related errors


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