{"record":{"id":"9b632371b26575a7","repo":"mastra-ai/mastra","slug":"observability-storage-get-score-aggregate-not-impl","errorCode":"OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED","errorMessage":"This storage provider does not support score aggregation","messagePattern":"This storage provider does not support score aggregation","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/observability/base.ts","lineNumber":614,"sourceCode":"      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support listing scores',\n    });\n  }\n\n  /**\n   * Retrieves a single score by its score ID.\n   */\n  async getScoreById(_scoreId: string): Promise<ScoreRecord | null> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support getting scores by ID',\n    });\n  }\n\n  async getScoreAggregate(_args: GetScoreAggregateArgs): Promise<GetScoreAggregateResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support score aggregation',\n    });\n  }\n\n  async getScoreBreakdown(_args: GetScoreBreakdownArgs): Promise<GetScoreBreakdownResponse> {\n    throw new MastraError({\n      id: 'OBSERVABILITY_STORAGE_GET_SCORE_BREAKDOWN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.MASTRA_OBSERVABILITY,\n      category: ErrorCategory.SYSTEM,\n      text: 'This storage provider does not support score breakdown',\n    });\n  }\n\n  async getScoreTimeSeries(_args: GetScoreTimeSeriesArgs): Promise<GetScoreTimeSeriesResponse> {\n    throw new MastraError({","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/observability/base.ts#L596-L632","documentation":"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.","triggerScenarios":"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.","commonSituations":"Custom/in-memory storage adapters; dashboard pages computing score summaries; mixed-version installs where a storage package predates the aggregate API.","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."],"exampleFix":"// before\nconst agg = await storage.getScoreAggregate({ scope: { type: 'agent' } }); // throws\n// after\ntry {\n  const agg = await storage.getScoreAggregate({ scope: { type: 'agent' } });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED') {\n    return computeAggregateClientSide(await storage.listScores({ scope: { type: 'agent' } }));\n  }\n  throw e;\n}","handlingStrategy":"fallback","validationCode":"const supportsAggregate = storage.constructor.prototype.hasOwnProperty('getScoreAggregate');\nif (!supportsAggregate) return computeAggregateFromListFallback();","typeGuard":"function hasAggregate(s: any): s is { getScoreAggregate: (a: any) => Promise<any> } {\n  return typeof s?.getScoreAggregate === 'function' && s.constructor.prototype.hasOwnProperty('getScoreAggregate');\n}","tryCatchPattern":"try {\n  return await storage.getScoreAggregate(args);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'OBSERVABILITY_STORAGE_GET_SCORE_AGGREGATE_NOT_IMPLEMENTED') {\n    return clientSideAggregate(await safeListScores(storage, args.scope));\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["storage","observability","not-implemented","aggregation"],"backgroundTag":"storage-capability-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}