mastra-ai/mastra · error · MastraError
MASTRA_SCORES_STORAGE_NOT_AVAILABLE
MASTRA_SCORES_STORAGE_NOT_AVAILABLE
Error message
Scores storage domain is not available
What it means
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.
Source
Thrown at packages/core/src/mastra/hooks.ts:125
entityId,
entityType,
},
},
error,
);
mastra.getLogger()?.trackException(mastraError);
}
};
}
/**
* @deprecated Legacy scores-store path. New score emission should use `mastra.observability.addScore()`.
*/
export async function validateAndSaveScore(storage: MastraStorage, payload: unknown) {
const scoresStore = await storage.getStore('scores');
if (!scoresStore) {
throw new MastraError({
id: 'MASTRA_SCORES_STORAGE_NOT_AVAILABLE',
domain: ErrorDomain.STORAGE,
category: ErrorCategory.SYSTEM,
text: 'Scores storage domain is not available',
});
}
const payloadToSave = saveScorePayloadSchema.parse(payload);
await scoresStore.saveScore(payloadToSave);
}
async function findScorer(mastra: Mastra, entityId: string, entityType: string, scorerId: string) {
let scorerToUse;
if (entityType === 'AGENT') {
try {
// Registry first, then stored agents via the editor.
const resolved = await resolveAgentById(mastra, entityId);
if (resolved.status === 'found') {
const scorers = await resolved.agent.listScorers();View on GitHub (pinned to 75dd419e61)
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.
Example fix
// before
await validateAndSaveScore(storage, payload);
// after
mastra.observability.addScore({ scorerId, entityId, entityType, ...payload }); Defensive patterns
Strategy: fallback
Validate before calling
const scoresStore = await storage.getStore('scores');
if (!scoresStore) {
await mastra.observability.addScore(payload); // supported alternative
} else {
await validateAndSaveScore(storage, payload);
} Type guard
async function hasScoresStore(s: MastraStorage): Promise<boolean> {
return !!(await s.getStore('scores'));
} Try / catch
try {
await validateAndSaveScore(storage, payload);
} catch (e) {
if (e instanceof MastraError && e.id === 'MASTRA_SCORES_STORAGE_NOT_AVAILABLE') {
await mastra.observability.addScore(payload);
return;
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- MASTRA_SCORES_STORAGE_NOT_AVAILABLE
- OBSERVABILITY_STORAGE_CREATE_SCORE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_LIST_SCORES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_GET_SCORE_BY_ID_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/7bfea9b0897bbb51.
Report an issue: GitHub.