{"record":{"id":"402e32e913735cc1","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-402e32","errorCode":null,"errorMessage":"Storage is not configured","messagePattern":"Storage is not configured","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"packages/server/src/server/handlers/stored-workspaces.ts","lineNumber":47,"sourceCode":"/**\n * GET /stored/workspaces - List all stored workspaces\n */\nexport const LIST_STORED_WORKSPACES_ROUTE = createRoute({\n  method: 'GET',\n  path: '/stored/workspaces',\n  responseType: 'json',\n  queryParamSchema: listStoredWorkspacesQuerySchema,\n  responseSchema: listStoredWorkspacesResponseSchema,\n  summary: 'List stored workspaces',\n  description: 'Returns a paginated list of all workspace configurations stored in the database',\n  tags: ['Stored Workspaces'],\n  requiresAuth: true,\n  handler: async ({ mastra, page, perPage, orderBy, authorId, metadata, 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 workspaceStore = await storage.getStore('workspaces');\n      if (!workspaceStore) {\n        throw new HTTPException(500, { message: 'Workspaces storage domain is not available' });\n      }\n\n      // Resolve the visibility scope for this caller. Non-owner queries for\n      // another author return nothing (workspaces have no `public` visibility\n      // yet); default lists return the caller's rows plus legacy unowned\n      // records.\n      const filter = resolveAuthorFilter({\n        requestContext,\n        resource: 'stored-workspaces',\n        queryAuthorId: authorId,\n      });\n\n      const scope = await getStoredResourceScope(mastra, requestContext);","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-workspaces.ts#L29-L65","documentation":"The GET /stored/workspaces list handler requires a configured storage instance because workspaces are persisted. mastra.getStorage() returned undefined, so the handler throws a 500 before touching the workspace store. Mastra cannot list stored workspaces without a database backend.","triggerScenarios":"GET /api/stored/workspaces on a Mastra instance constructed without a storage option (no LibSQL/PG/Upstash storage configured).","commonSituations":"Local dev/prototype Mastra instance created without storage; storage removed during refactor; deploying the playground/server against an in-memory Mastra that never had persistence wired.","solutions":["Configure storage when constructing Mastra, e.g. new Mastra({ storage: new MastraStorage({ ... }) }) with a concrete adapter like LibSQLStore or PgStore","Set the storage connection env vars (database URL etc.) your adapter requires","If storage should be optional, guard the client: check the error and skip stored-workspace features when unconfigured","Restart the server after adding storage config to the Mastra constructor"],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: { weather } });\n// after\nimport { Mastra } from '@mastra/core';\nimport { LibSQLStore } from '@mastra/libsql';\nexport const mastra = new Mastra({\n  agents: { weather },\n  storage: new LibSQLStore({ url: process.env.DATABASE_URL! }),\n});","handlingStrategy":"validation","validationCode":"import { Mastra } from '@mastra/core';\nexport function assertStorage(mastra: Mastra) {\n  if (!mastra.getStorage()) {\n    throw new Error('Configure storage: new Mastra({ storage: new LibSQLStore({ url: process.env.DATABASE_URL! }) })');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(`${baseUrl}/api/stored/workspaces`);\n  if (!res.ok) throw Object.assign(new Error(await res.text()), { status: res.status });\n} catch (e: any) {\n  if (e.status === 500 && String(e.message).includes('Storage is not configured')) {\n    console.error('Add a storage adapter to your Mastra instance');\n  } else throw e;\n}","preventionTips":["Always pass storage when constructing Mastra for any persisted feature","Load DATABASE_URL from env with a startup assertion","Smoke-test GET /stored/workspaces after deploy to verify persistence","Keep server and storage-adapter versions in sync"],"tags":["storage","configuration","http-500","workspaces"],"backgroundTag":"missing-storage-configuration","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}