mastra-ai/mastra · warning · MastraError

OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED

OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED

Error message

This storage provider does not support metric name discovery

What it means

MastraError OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED. The observability storage base class declares getMetricNames as an optional capability; the default implementation unconditionally throws this error. It is thrown when the active storage provider has not overridden getMetricNames, meaning metric name discovery is not available for that backend. It is a deliberate 'capability not implemented' signal, not a runtime failure.

Source

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

      text: 'This storage provider does not support metric time series',
    });
  }

  async getMetricPercentiles(_args: GetMetricPercentilesArgs): Promise<GetMetricPercentilesResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support metric percentiles',
    });
  }

  // ============================================================================
  // Discovery / Metadata Methods
  // ============================================================================

  async getMetricNames(_args: GetMetricNamesArgs): Promise<GetMetricNamesResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support metric name discovery',
    });
  }

  async getMetricLabelKeys(_args: GetMetricLabelKeysArgs): Promise<GetMetricLabelKeysResponse> {
    throw new MastraError({
      id: 'OBSERVABILITY_STORAGE_GET_METRIC_LABEL_KEYS_NOT_IMPLEMENTED',
      domain: ErrorDomain.MASTRA_OBSERVABILITY,
      category: ErrorCategory.SYSTEM,
      text: 'This storage provider does not support metric label key discovery',
    });
  }

  async getMetricLabelValues(_args: GetMetricLabelValuesArgs): Promise<GetMetricLabelValuesResponse> {
    throw new MastraError({

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Switch to a storage provider that implements metric name discovery (e.g. the official Postgres/ClickHouse observability backends)
  2. Implement getMetricNames in your custom storage domain class, returning the metric names you persist
  3. Wrap the call in try/catch and degrade gracefully (return an empty list or hide discovery UI) when the backend lacks support

Example fix

// before
const names = await storage.getMetricNames({});
// after
let names = [];
try {
  names = (await storage.getMetricNames({})).metricNames ?? [];
} catch (e) {
  if (e.id !== 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED') throw e;
}
Defensive patterns

Strategy: fallback

Validate before calling

// capability probe
async function supportsMetricNames(storage) {
  try { await storage.getMetricNames({}); return true; }
  catch (e) { return e?.id === 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED' ? false : true; }
}

Type guard

function isNotImplementedError(e: unknown): e is MastraError {
  return e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_METRIC_NAMES_NOT_IMPLEMENTED';
}

Try / catch

try {
  const res = await storage.getMetricNames(args);
} catch (e) {
  if (isNotImplementedError(e)) return { metricNames: [] };
  throw e;
}

Prevention

When it happens

Trigger: Calling getMetricNames(args) on a storage instance whose class extends MastraObservabilityStorage (base.ts) without overriding the method — e.g. an in-memory or minimal storage adapter used with the observability metrics API.

Common situations: Using a storage adapter (LibSQL, in-memory, or a custom driver) that predates observability metrics support; swapping storage backends and assuming all MastraStorage domains are fully implemented; calling the metrics discovery API through the server/API layer against a provider lacking the feature.

Related errors


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