{"record":{"id":"0857abf4d556796e","repo":"mastra-ai/mastra","slug":"storage-not-configured-0857ab","errorCode":null,"errorMessage":"Storage not configured","messagePattern":"Storage not configured","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"packages/server/src/server/handlers/scores.ts","lineNumber":349,"sourceCode":"});\n\nexport const SAVE_SCORE_ROUTE = createRoute({\n  method: 'POST',\n  path: '/scores',\n  responseType: 'json',\n  bodySchema: saveScoreBodySchema,\n  responseSchema: saveScoreResponseSchema,\n  summary: 'Save score',\n  description: 'Saves a new score record to storage',\n  tags: ['Scoring'],\n  requiresAuth: true,\n  handler: async ({ mastra, ...params }) => {\n    try {\n      const { score } = params as { score: ScoreRowData };\n      const scoresStore = await mastra.getStorage()?.getStore('scores');\n      const result = await scoresStore?.saveScore?.(score);\n      if (!result) {\n        throw new HTTPException(500, { message: 'Storage not configured' });\n      }\n      return result;\n    } catch (error) {\n      return handleError(error, 'Error saving score');\n    }\n  },\n});\n","sourceCodeStart":331,"sourceCodeEnd":357,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/scores.ts#L331-L357","documentation":"Thrown by the score-saving handler when `mastra.getStorage()` returns undefined or the scores store/saveScore is unavailable, so no result is produced. The server requires a configured storage backend to persist scoring data; without one, saving a score cannot succeed.","triggerScenarios":"POSTing to the scores endpoint on a Mastra instance constructed without a `storage` option, or with a storage backend that lacks a scores store (e.g. a storage adapter that does not implement saveScore).","commonSituations":"Forgetting to pass storage in `new Mastra({...})`; using an in-memory/dev setup in production; a storage package version that predates the scores store API; storage misconfigured env vars preventing initialization.","solutions":["Configure storage on the Mastra instance: `new Mastra({ storage: new MastraLibsqlStorage({ url: 'file:./mastra.db' }) })` or your preferred adapter.","Verify the storage adapter implements the scores store (`getStore('scores')` and `saveScore`).","Upgrade @mastra/core and your storage package to compatible versions.","Check that storage-related env vars (DB URL, connection string) are set in the server environment."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: { weatherAgent } });\n// after\nimport { MastraStorage } from '@mastra/core/storage';\nexport const mastra = new Mastra({ agents: { weatherAgent }, storage: new LibSQLStore({ url: process.env.DATABASE_URL }) });","handlingStrategy":"validation","validationCode":"const storage = mastra.getStorage();\nif (!storage) throw new Error('Mastra storage is not configured; scores cannot be saved.');\nconst scoresStore = await storage.getStore('scores');\nif (!scoresStore?.saveScore) throw new Error('Configured storage does not support the scores store.');","typeGuard":"function hasScoresStore(s): s is { getStore: (n: 'scores') => Promise<{ saveScore: Function } | undefined> | undefined } {\n  return typeof s?.getStore === 'function';\n}","tryCatchPattern":"try {\n  await client.saveScore(score);\n} catch (e) {\n  if (e instanceof MastraClientError && e.status === 500 && /Storage not configured/.test(e.message)) {\n    console.error('Server has no storage backend; configure `storage` on the Mastra instance.');\n  } else throw e;\n}","preventionTips":["Always pass a `storage` adapter when constructing the Mastra instance served by the server.","Smoke-test storage at startup (e.g. write and read a trivial record) before accepting traffic.","Keep @mastra/core and the storage package versions aligned so the scores store exists.","Set and verify storage env vars in every deployment environment."],"tags":["storage","configuration","http-500"],"backgroundTag":"storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}