mastra-ai/mastra · error · MastraError
OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED
OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED
Error message
This storage provider does not support score aggregation
What it means
getScoreAggregate computes aggregate statistics (counts, averages) over scores, which requires provider-specific query support; the base class throws this instead of a wrong empty result. Seeing it means your storage adapter does not implement score aggregation.
Source
Thrown at packages/core/src/storage/domains/observability/base.ts:614
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({
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({View on GitHub (pinned to 75dd419e61)
Solutions
- Switch to a fully featured storage provider that implements aggregation (libsql, postgres, upstash).
- Implement getScoreAggregate in your adapter (COUNT/AVG-style query over the scores table).
- Catch the error and fall back to client-side aggregation via listScores if the provider supports listing.
- Align @mastra/storage package versions with @mastra/core.
Example fix
// before
const agg = await storage.getScoreAggregate({ scope: { type: 'agent' } }); // throws
// after
try {
const agg = await storage.getScoreAggregate({ scope: { type: 'agent' } });
} catch (e) {
if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED') {
return computeAggregateClientSide(await storage.listScores({ scope: { type: 'agent' } }));
}
throw e;
} Defensive patterns
Strategy: fallback
Validate before calling
const supportsAggregate = storage.constructor.prototype.hasOwnProperty('getScoreAggregate');
if (!supportsAggregate) return computeAggregateFromListFallback(); Type guard
function hasAggregate(s: any): s is { getScoreAggregate: (a: any) => Promise<any> } {
return typeof s?.getScoreAggregate === 'function' && s.constructor.prototype.hasOwnProperty('getScoreAggregate');
} Try / catch
try {
return await storage.getScoreAggregate(args);
} catch (e) {
if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED') {
return clientSideAggregate(await safeListScores(storage, args.scope));
}
throw e;
} Prevention
- Prefer storage providers with full analytics support for dashboards
- Implement aggregation overrides when writing custom adapters
- Fallback to client-side aggregation where data volume permits
- Test adapter capability matrix in CI
When it happens
Trigger: Calling storage.getScoreAggregate({ scope, ... }) on an adapter extending the base without overriding the method, or via tooling/UI that requests score summary stats from a minimal provider.
Common situations: Custom/in-memory storage adapters; dashboard pages computing score summaries; mixed-version installs where a storage package predates the aggregate API.
Related errors
- OBSERVABILITY_STORAGE_GET_METRIC_AGGREGATE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_FEEDBACK_AGGREGATE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_UPDATE_SPANS_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_DELETE_TRACES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_CREATE_LOGS_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/9b632371b26575a7.
Report an issue: GitHub.