{"record":{"id":"990e52a0b8164c90","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-990e52","errorCode":null,"errorMessage":"Storage is not configured","messagePattern":"Storage is not configured","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"critical","filePath":"packages/server/src/server/handlers/prompt-block-versions.ts","lineNumber":50,"sourceCode":" * GET /stored/prompt-blocks/:promptBlockId/versions - List all versions for a prompt block\n */\nexport const LIST_PROMPT_BLOCK_VERSIONS_ROUTE = createRoute({\n  method: 'GET',\n  path: '/stored/prompt-blocks/:promptBlockId/versions',\n  requiresAuth: true,\n  responseType: 'json',\n  pathParamSchema: promptBlockVersionPathParams,\n  queryParamSchema: listPromptBlockVersionsQuerySchema,\n  responseSchema: listPromptBlockVersionsResponseSchema,\n  summary: 'List prompt block versions',\n  description: 'Returns a paginated list of all versions for a stored prompt block',\n  tags: ['Prompt Block Versions'],\n  handler: async ({ mastra, promptBlockId, page, perPage, orderBy, requestContext }) => {\n    try {\n      const storage = mastra.getStorage();\n\n      if (!storage) {\n        throw new HTTPException(500, { message: 'Storage is not configured' });\n      }\n\n      const promptBlockStore = await storage.getStore('promptBlocks');\n      if (!promptBlockStore) {\n        throw new HTTPException(500, { message: 'Prompt blocks storage domain is not available' });\n      }\n\n      const promptBlock = await promptBlockStore.getById(promptBlockId);\n      if (!promptBlock) {\n        throw new HTTPException(404, { message: `Prompt block with id ${promptBlockId} not found` });\n      }\n      assertStoredResourceScope(promptBlock, await getStoredResourceScope(mastra, requestContext));\n\n      const result = await promptBlockStore.listVersions({\n        blockId: promptBlockId,\n        page,\n        perPage,\n        orderBy,","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/prompt-block-versions.ts#L32-L68","documentation":"Listing prompt block versions requires persistent storage. If mastra.getStorage() returns undefined (no storage configured on the Mastra instance), the handler throws HTTP 500 'Storage is not configured'. Mastra features that persist data simply cannot function without a storage backend.","triggerScenarios":"GET the prompt-block versions route on a Mastra instance constructed without a storage option (no MastraStorage passed), so getStorage() is undefined.","commonSituations":"Dev servers started with only models/agents configured; in-memory prototypes promoted to features needing persistence; deployment configs missing DATABASE_URL or equivalent storage wiring.","solutions":["Configure storage on the Mastra instance, e.g. new Mastra({ storage: new MastraLibsql({ url: 'file:./mastra.db' }) }).","Verify the storage plugin/package is installed and imported in mastra/ config.","In deployments, ensure the storage env vars (e.g. DATABASE_URL) are set."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: { weatherAgent } });\n// after\nimport { MastraLibsql } from '@mastra/libsql';\nexport const mastra = new Mastra({ agents: { weatherAgent }, storage: new MastraLibsql({ url: process.env.DATABASE_URL! }) });","handlingStrategy":"try-catch","validationCode":"if (!mastra.getStorage()) {\n  throw new Error('Configure storage on the Mastra instance before using prompt blocks');\n}","typeGuard":"function hasStorage(m: Mastra): boolean {\n  return Boolean(m.getStorage());\n}","tryCatchPattern":"try {\n  const versions = await client.getPromptBlockVersions(id);\n} catch (e) {\n  if (e.status === 500 && e.message === 'Storage is not configured') {\n    console.error('Mastra instance has no storage; configure MastraStorage to use prompt blocks');\n    return;\n  }\n  throw e;\n}","preventionTips":["Always pass a storage adapter when constructing Mastra for server use.","Add a boot-time assertion that getStorage() is defined for persistence features.","Keep storage env vars documented and validated at startup (e.g. DATABASE_URL)."],"tags":["http-500","storage","configuration"],"backgroundTag":"storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}