{"record":{"id":"7bfea9b0897bbb51","repo":"mastra-ai/mastra","slug":"mastra-scores-storage-not-available-7bfea9","errorCode":"MASTRA_SCORES_STORAGE_NOT_AVAILABLE","errorMessage":"Scores storage domain is not available","messagePattern":"Scores storage domain is not available","errorType":"error_code","errorClass":"MastraError","httpStatus":null,"severity":"error","filePath":"packages/core/src/mastra/hooks.ts","lineNumber":125,"sourceCode":"            entityId,\n            entityType,\n          },\n        },\n        error,\n      );\n\n      mastra.getLogger()?.trackException(mastraError);\n    }\n  };\n}\n\n/**\n * @deprecated Legacy scores-store path. New score emission should use `mastra.observability.addScore()`.\n */\nexport async function validateAndSaveScore(storage: MastraStorage, payload: unknown) {\n  const scoresStore = await storage.getStore('scores');\n  if (!scoresStore) {\n    throw new MastraError({\n      id: 'MASTRA_SCORES_STORAGE_NOT_AVAILABLE',\n      domain: ErrorDomain.STORAGE,\n      category: ErrorCategory.SYSTEM,\n      text: 'Scores storage domain is not available',\n    });\n  }\n  const payloadToSave = saveScorePayloadSchema.parse(payload);\n  await scoresStore.saveScore(payloadToSave);\n}\n\nasync function findScorer(mastra: Mastra, entityId: string, entityType: string, scorerId: string) {\n  let scorerToUse;\n  if (entityType === 'AGENT') {\n    try {\n      // Registry first, then stored agents via the editor.\n      const resolved = await resolveAgentById(mastra, entityId);\n      if (resolved.status === 'found') {\n        const scorers = await resolved.agent.listScorers();","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/mastra/hooks.ts#L107-L143","documentation":"validateAndSaveScore (deprecated legacy path) requests the 'scores' domain store from storage via storage.getStore('scores'); if the configured storage backend does not implement/enable the scores store, this SYSTEM-category error is thrown before persisting. New code should use mastra.observability.addScore() instead.","triggerScenarios":"Emitting scores through the legacy scores-store path (validateAndSaveScore / deprecated score emission APIs) while using a storage adapter or version that lacks a scores domain (getStore('scores') returns undefined).","commonSituations":"Using an older or minimal storage adapter (or storage configured without scores table support) with score saving enabled; upgrading Mastra where the scores store moved to observability.addScore and the legacy hook path is still used.","solutions":["Migrate to mastra.observability.addScore(...) — the deprecated path will not work without a scores store.","Configure a storage backend that supports the scores domain (e.g. current LibSQL/Postgres/Upstash adapters) via Mastra({ storage }).","Update the storage adapter package to a version that implements the scores store.","If the scores store is genuinely not needed, remove the scorer persistence path instead of relying on the legacy hook."],"exampleFix":"// before\nawait validateAndSaveScore(storage, payload);\n// after\nmastra.observability.addScore({ scorerId, entityId, entityType, ...payload });","handlingStrategy":"fallback","validationCode":"const scoresStore = await storage.getStore('scores');\nif (!scoresStore) {\n  await mastra.observability.addScore(payload); // supported alternative\n} else {\n  await validateAndSaveScore(storage, payload);\n}","typeGuard":"async function hasScoresStore(s: MastraStorage): Promise<boolean> {\n  return !!(await s.getStore('scores'));\n}","tryCatchPattern":"try {\n  await validateAndSaveScore(storage, payload);\n} catch (e) {\n  if (e instanceof MastraError && e.id === 'MASTRA_SCORES_STORAGE_NOT_AVAILABLE') {\n    await mastra.observability.addScore(payload);\n    return;\n  }\n  throw e;\n}","preventionTips":["Prefer mastra.observability.addScore() for all new score emission","Use a storage adapter version that implements the scores domain","Check getStore('scores') availability when switching storage backends"],"tags":["storage","scores","deprecated","observability"],"backgroundTag":"storage-domain-unavailable","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}