mastra-ai/mastra · error · MastraError
OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED
OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED
Error message
This storage provider does not support listing metrics
What it means
MastraError OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED is thrown by the abstract base class MastraStorage observability domain (packages/core/src/storage/domains/observability/base.ts:441) from listMetrics(). Storage adapters inherit this default implementation and it always throws; it fires when the configured storage provider does not implement observability metrics listing. It signals an adapter capability gap, not bad input from the caller.
Source
Thrown at packages/core/src/storage/domains/observability/base.ts:441
// ============================================================================
// Metrics
// ============================================================================
/**
* Creates multiple metric observations in a single batch.
*/
async batchCreateMetrics(_args: BatchCreateMetricsArgs): Promise<void> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_BATCH_CREATE_METRICS_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support batch creating metrics',
});
}
async listMetrics(_args: ListMetricsArgs): Promise<ListMetricsResponse> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support listing metrics',
});
}
async getMetricAggregate(_args: GetMetricAggregateArgs): Promise<GetMetricAggregateResponse> {
throw new MastraError({
id: 'OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED',
domain: ErrorDomain.MASTRA_OBSERVABILITY,
category: ErrorCategory.SYSTEM,
text: 'This storage provider does not support metric aggregation',
});
}
async getMetricBreakdown(_args: GetMetricBreakdownArgs): Promise<GetMetricBreakdownResponse> {
throw new MastraError({View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to a storage adapter that implements the observability metrics domain (e.g. PostgreSQL/up-to-date official adapters) or upgrade the storage adapter package to the latest version.
- Verify how listMetrics is being invoked (custom code vs Studio UI); if the UI is hitting it, disable the metrics feature or point the server at a metrics-capable storage.
- If you wrote a custom MastraStorage subclass, implement listMetrics to return your provider's data (or an empty ListMetricsResponse) instead of inheriting the throwing default.
- Feature-detect before calling: check whether the storage instance overrides listMetrics and show a 'not supported' state instead of crashing.
Example fix
// before
const storage = new MinimalStorage(config); // no metrics support
await storage.listMetrics({}); // throws OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED
// after
const storage = new PostgresStore(config); // adapter implementing metrics domain
await storage.listMetrics({}); // returns ListMetricsResponse Defensive patterns
Strategy: fallback
Validate before calling
import { MastraStorage } from '@mastra/core/storage';
function supportsListMetrics(storage: unknown): boolean {
return (
storage instanceof MastraStorage &&
(storage as MastraStorage).listMetrics !== MastraStorage.prototype.listMetrics
);
}
if (!supportsListMetrics(storage)) {
console.warn('Storage adapter does not support metric listing; skipping metrics view');
} Type guard
function supportsListMetrics(s: unknown): s is MastraStorage & { listMetrics: (a: ListMetricsArgs) => Promise<ListMetricsResponse> } {
return s instanceof MastraStorage && s.listMetrics !== MastraStorage.prototype.listMetrics;
} Try / catch
import { MastraError } from '@mastra/core/error';
try {
const metrics = await storage.listMetrics(args);
} catch (err) {
if (err instanceof MastraError && err.id === 'OBSERVABILITY_STORAGE_LIST_METRICS_NOT_IMPLEMENTED') {
const metrics = { metrics: [] } as ListMetricsResponse; // graceful empty fallback
} else {
throw err;
}
} Prevention
- Check the adapter's observability/metrics support matrix before choosing a storage provider.
- Keep @mastra/core and the storage adapter package versions in lockstep.
- When writing a custom MastraStorage subclass, override all metrics methods you intend to support and audit the rest.
- Feature-detect listMetrics against MastraStorage.prototype before wiring metrics UI or jobs.
- Add an integration test asserting which observability methods your adapter implements.
When it happens
Trigger: Calling listMetrics() (directly, or via Mastra observability APIs / Studio UI that enumerate metrics) on a storage adapter that has not overridden listMetrics — e.g. legacy or minimal providers like LibSQL/InMemory/D1-style adapters configured without metrics support.
Common situations: Developer wires a storage adapter that only implements traces/logs, then opens the metrics view in Mastra Studio or runs an observability query; upgrading Mastra where metrics APIs were added but the installed storage adapter (or a custom MastraStorage subclass) predates them; writing a custom storage adapter and forgetting to implement listMetrics.
Related errors
- OBSERVABILITY_STORAGE_BATCH_CREATE_METRICS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_BREAKDOWN_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_TIME_SERIES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_METRIC_PERCENTILES_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/c77b05b875c643db.
Report an issue: GitHub.