{"record":{"id":"cffd5a1b0ce5adef","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-cffd5a","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/stored-agents.ts","lineNumber":255,"sourceCode":"  requiresAuth: true,\n  handler: async ({\n    mastra,\n    requestContext,\n    page,\n    perPage,\n    orderBy,\n    status,\n    authorId,\n    visibility,\n    metadata,\n    favoritedOnly,\n    pinFavoritedFor,\n  }) => {\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 agentsStore = await storage.getStore('agents');\n      if (!agentsStore) {\n        throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n      }\n\n      // Resolve the visibility scope for this caller. Non-owner queries for\n      // another author return only that author's public rows; default lists\n      // return the caller's rows plus legacy unowned records.\n      const filter = resolveAuthorFilter({\n        requestContext,\n        resource: 'stored-agents',\n        queryAuthorId: authorId,\n        queryVisibility: visibility === 'public' ? 'public' : undefined,\n      });\n\n      const scope = await getStoredResourceScope(mastra, requestContext);","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-agents.ts#L237-L273","documentation":"LIST_STORED_AGENTS (GET /stored/agents) requires persistent storage; mastra.getStorage() returned undefined, so the server cannot read stored agents at all. The library throws HTTP 500 because listing stored agents is impossible without a configured storage adapter — this is a server deployment/configuration problem, not a client error.","triggerScenarios":"Calling GET /stored/agents (any list query, including favoritedOnly) against a Mastra server instantiated without storage: no storage option passed to the Mastra constructor, or storage removed during a config refactor.","commonSituations":"Running mastra dev with a minimal config and no storage: new Mastra({...}) missing storage; deploying without setting the database env vars the storage adapter needs; upgrading Mastra where storage moved to a required field; examples/hello-world configs promoted to a real server.","solutions":["Configure a storage adapter: new Mastra({ storage: new MastraStorage(...) }) (e.g. @mastra/pg, @mastra/libsql)","Set the required connection env vars for the chosen storage backend (e.g. DATABASE_URL)","Verify mastra.getStorage() in the deployed instance returns the adapter (add a startup check/log)","If storage is intentionally absent, do not expose the stored-agents routes"],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: {} });\n// after\nimport { MastraStorage } from '@mastra/core/storage';\nimport { PostgresStore } from '@mastra/pg';\nexport const mastra = new Mastra({ agents: {}, storage: new PostgresStore({ connectionString: process.env.DATABASE_URL }) });","handlingStrategy":"fallback","validationCode":"import { mastra } from './mastra';\nif (!mastra.getStorage()) throw new Error('Configure storage before using stored-agents routes');","typeGuard":"function hasStorage(m: { getStorage(): unknown }): boolean { return Boolean(m.getStorage()); }","tryCatchPattern":"try {\n  const res = await get('/stored/agents');\n  return res;\n} catch (e) {\n  if ((e as any).status === 500 && /Storage is not configured/.test((e as any).message)) {\n    throw new Error('Server deployed without storage; set a storage adapter in the Mastra constructor');\n  }\n  throw e;\n}","preventionTips":["Always pass storage when using stored agents/favorites/workflows","Add a startup health check that mastra.getStorage() is set","Keep database env vars in every deployment environment","Document storage as a hard requirement for the stored-agents API"],"tags":["http-500","storage","server-configuration"],"backgroundTag":"storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}