mastra-ai/mastra · error · MastraError

OBSERVABILITY_STORAGE_GET_SCORE_PERCENTILES_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_GET_SCORE_PERCENTILES_NOT_IMPLEMENTED

Error message

This storage provider does not support score percentiles

What it means

getScorePercentiles computes percentile distributions (p50/p90/etc.) over scores; the observability base class throws by default because percentiles need provider-specific query math. The error means the configured adapter never overrode this capability.

Source

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

    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SCORE_BREAKDOWN_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support score breakdown',
    });
  }

  async getScoreTimeSeries(_args: GetScoreTimeSeriesArgs): Promise<GetScoreTimeSeriesResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SCORE_TIME_SERIES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support score time series',
    });
  }

  async getScorePercentiles(_args: GetScorePercentilesArgs): Promise<GetScorePercentilesResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_SCORE_PERCENTILES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support score percentiles',
    });
  }

  // ============================================================================
  // Feedback
  // ============================================================================

  /**
   * Creates a single feedback record.
   */
  async createFeedback(_args: CreateFeedbackArgs): Promise<void> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_CREATE_FEEDBACK_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Switch to a storage provider that implements percentiles (libsql, postgres, upstash).
  2. Override getScorePercentiles in your custom adapter (e.g. PERCENTILE_CONT query).
  3. Catch the error and compute percentiles client-side from listScores output.
  4. Update the adapter package to a version implementing current score APIs.

Example fix

// before
const p = await storage.getScorePercentiles({ scope, percentiles: [50, 90, 99] }); // throws
// after
try {
  const p = await storage.getScorePercentiles({ scope, percentiles: [50, 90, 99] });
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_PERCENTILES_NOT_IMPLEMENTED') {
    return computePercentiles(await storage.listScores({ scope }), [50, 90, 99]);
  }
  throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

const supportsPercentiles = storage.constructor.prototype.hasOwnProperty('getScorePercentiles');
if (!supportsPercentiles) return computePercentilesClientSide(scores, percentiles);

Type guard

function hasPercentiles(s: any): s is { getScorePercentiles: (a: any) => Promise<any> } {
  return typeof s?.getScorePercentiles === 'function' && s.constructor.prototype.hasOwnProperty('getScorePercentiles');
}

Try / catch

try {
  return await storage.getScorePercentiles(args);
} catch (e) {
  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_PERCENTILES_NOT_IMPLEMENTED') {
    return computePercentilesClientSide(await safeListScores(storage, { scope: args.scope }), args.percentiles);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling storage.getScorePercentiles({ scope, percentiles, timeRange }) on an adapter extending the base without an implementation, or via score-analytics tooling pointed at a minimal provider.

Common situations: Custom storage backends; percentile dashboards; adapters that predate the percentiles API in @mastra/core.

Related errors


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