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
This MastraError is thrown by the deprecated legacy scores-save path in scoreTracesWorkflow when the storage adapter cannot provide a 'scores' domain store. MastraStorage is domain-modular: `storage.getStore('scores')` returns null when the configured storage class does not implement the scores domain. The workflow aborts instead of silently dropping the score record.
Source
Thrown at packages/core/src/evals/scoreTraces/scoreTracesWorkflow.ts:379
const scoredCount = results.filter(result => result.ok).length;
return {
...(batchId ? { batchId } : {}),
...(datasetId ? { datasetId } : {}),
scoredCount,
failedCount: results.length - scoredCount,
results,
};
}
/**
* @deprecated Legacy scores-store path. New score emission should use `mastra.observability.addScore()`.
*/
async function validateAndSaveScore({ storage, scorerResult }: { storage: MastraStorage; scorerResult: ScorerRun }) {
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(scorerResult);
const result = await scoresStore.saveScore(payloadToSave);
return result.score;
}
function buildScorerRun({
scorerType,
trace,
targetSpan,
}: {
scorerType?: string;
trace: TraceRecord;View on GitHub (pinned to 75dd419e61)
Solutions
- Use a supported storage adapter that implements the scores domain (e.g. current @mastra/libsql, @mastra/pg, @mastra/upstash) and pass it to Mastra
- Upgrade the storage package to a version matching @mastra/core so getStore('scores') is supported
- Migrate score emission to `mastra.observability.addScore()`, which is the recommended path and replaces this deprecated workflow
Example fix
// before
new Mastra({ storage: new MinimalStorage() });
// after
import { LibSQLStore } from '@mastra/libsql';
new Mastra({ storage: new LibSQLStore({ url: 'file:./mastra.db' }) }); Defensive patterns
Strategy: validation
Validate before calling
const scoresStore = await storage.getStore('scores');
if (!scoresStore) {
throw new Error('Storage adapter does not support the scores domain; use a full adapter (e.g. @mastra/libsql/@mastra/pg) or mastra.observability.addScore().');
} Type guard
function hasScoresStore(s: MastraStorage | undefined): s is MastraStorage & { getStore: (d: 'scores') => Promise<object> } {
return !!s && typeof s.getStore === 'function';
} Try / catch
try {
await runScoreTracesWorkflow(...);
} catch (e) {
if (e instanceof MastraError && e.id === 'MASTRA_SCORES_STORAGE_NOT_AVAILABLE') {
logger.warn('Scores storage unavailable; falling back to observability.addScore()');
} else throw e;
} Prevention
- Use officially supported storage adapters that implement all domains
- Keep @mastra/core and the storage package versions in lockstep
- Prefer mastra.observability.addScore() over the deprecated scores-store path
- Smoke-test storage domain availability at startup (await storage.getStore('scores'))
When it happens
Trigger: Calling the legacy score-traces workflow (validateAndSaveScore, invoked by savedScoreRecord) with a storage instance whose class does not implement the scores store domain — e.g. a minimal/custom MastraStorage implementation or an older adapter lacking scores support.
Common situations: Using a custom or third-party storage adapter that predates or omits the scores domain; upgrading @mastra/core but not the storage package; selecting an in-memory/minimal storage for local runs while running scoring workflows.
Related errors
- MASTRA_SCORES_STORAGE_NOT_AVAILABLE
- ScoresStorage not configured.
- OBSERVABILITY_STORAGE_CREATE_SCORE_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_BATCH_CREATE_SCORES_NOT_IMPLEMENTED
- OBSERVABILITY_STORAGE_LIST_SCORES_NOT_IMPLEMENTED
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/3ffd962b4253d345.
Report an issue: GitHub.