{"record":{"id":"8af3999319d986fd","repo":"mastra-ai/mastra","slug":"scores-storage-get-scores-by-span-not-implemented","errorCode":"SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED","errorMessage":"SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED","messagePattern":"SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/scores/base.ts","lineNumber":37,"sourceCode":"    });\n  }\n\n  async dangerouslyClearAll(): Promise<void> {\n    // Default no-op - subclasses override\n  }\n\n  abstract getScoreById({ id }: { id: string }): Promise<ScoreRowData | null>;\n\n  abstract saveScore(score: SaveScorePayload): Promise<{ score: ScoreRowData }>;\n\n  abstract listScoresByScorerId(input: ListScoresByScorerIdInput): Promise<ListScoresResponse>;\n\n  abstract listScoresByRunId(input: ListScoresByRunIdInput): Promise<ListScoresResponse>;\n\n  abstract listScoresByEntityId(input: ListScoresByEntityIdInput): Promise<ListScoresResponse>;\n\n  async listScoresBySpan({ traceId, spanId }: ListScoresBySpanInput): Promise<ListScoresResponse> {\n    throw new MastraError({\n      id: 'SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED',\n      domain: ErrorDomain.STORAGE,\n      category: ErrorCategory.SYSTEM,\n      details: { traceId, spanId },\n    });\n  }\n}\n","sourceCodeStart":19,"sourceCodeEnd":45,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/scores/base.ts#L19-L45","documentation":"listScoresBySpan has no default implementation on the abstract MastraStorage scores domain: the base class deliberately throws a MastraError with id SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED. Hitting this means the storage adapter in use does not support querying scores by trace/span pair.","triggerScenarios":"Calling storage.listScoresBySpan({ traceId, spanId }) on an adapter that has not overridden the method (e.g. a minimal or custom storage class, or an older adapter version lacking span-level score queries).","commonSituations":"Switching storage backends (e.g. to LibSQL/Upstash/custom) whose implementation doesn't implement this optional method; calling a newer API surface against an older adapter; custom storage subclasses that only implement the abstract methods.","solutions":["Upgrade or switch to a storage adapter that implements listScoresBySpan.","Use listScoresByEntityId or listScoresByRunId instead and filter results client-side by traceId/spanId if supported.","Implement listScoresBySpan in your custom storage subclass.","Add a feature check / try-catch around the call and degrade gracefully."],"exampleFix":"// before\nconst scores = await storage.listScoresBySpan({ traceId, spanId }); // throws\n// after\nconst { scores: all } = await storage.listScoresByEntityId({ entityId: 'agent-1' });\nconst spanScores = all.filter(s => s.traceId === traceId && s.spanId === spanId);","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"function supportsListScoresBySpan(s: unknown): s is { listScoresBySpan: Function } {\n  return typeof (s as any)?.listScoresBySpan === 'function' &&\n    !s.constructor?.name?.includes('Base');\n}","tryCatchPattern":"try {\n  return await storage.listScoresBySpan({ traceId, spanId });\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'SCORES_STORAGE_GET_SCORES_BY_SPAN_NOT_IMPLEMENTED') {\n    logger.warn('listScoresBySpan unsupported by adapter; falling back');\n    return await storage.listScoresByEntityId({ entityId }).then(r => filterBySpan(r, traceId, spanId));\n  }\n  throw e;\n}","preventionTips":["Check your storage adapter's supported score-query methods before using span-level queries.","Upgrade adapters to versions that implement listScoresBySpan.","Prefer listScoresByEntityId/listScoresByRunId when span granularity is optional.","Feature-detect adapter capabilities at startup and log unsupported paths."],"tags":["storage","not-implemented","scores","unsupported-operation"],"backgroundTag":"method-not-implemented","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}