{"record":{"id":"32da311dd77f400e","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-32da31","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-agent-favorites.ts","lineNumber":17,"sourceCode":"import { HTTPException } from '../http-exception';\nimport { favoriteToggleResponseSchema } from '../schemas/favorites';\nimport { storedAgentIdPathParams } from '../schemas/stored-agents';\nimport { createRoute } from '../server-adapter/routes/route-builder';\nimport { assertStoredResourceScope, getStoredResourceScope } from '../utils';\n\nimport { assertReadAccess, getCallerAuthorId } from './authorship';\nimport { requireBuilderFeature } from './editor-builder';\nimport { handleError } from './error';\n\n/**\n * Resolves the storage and favorites domains, throwing 500 if unavailable.\n */\nasync function getFavoritesContext(mastra: Parameters<typeof requireBuilderFeature>[0]) {\n  const storage = mastra.getStorage();\n  if (!storage) {\n    throw new HTTPException(500, { message: 'Storage is not configured' });\n  }\n  const agentStore = await storage.getStore('agents');\n  if (!agentStore) {\n    throw new HTTPException(500, { message: 'Agents storage domain is not available' });\n  }\n  const favoritesStore = await storage.getStore('favorites');\n  if (!favoritesStore) {\n    throw new HTTPException(500, { message: 'Favorites storage domain is not available' });\n  }\n  return { agentStore, favoritesStore };\n}\n\n/**\n * PUT /stored/agents/:storedAgentId/favorite\n */\nexport const FAVORITE_STORED_AGENT_ROUTE = createRoute({\n  method: 'PUT',\n  path: '/stored/agents/:storedAgentId/favorite',","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-agent-favorites.ts#L1-L35","documentation":"getFavoritesContext resolves storage via mastra.getStorage() for the stored-agent favorites endpoints. If no storage is configured on the Mastra instance, it throws HTTPException 500 because favorites cannot be persisted without a storage backend. The library requires an explicit storage configuration for builder favorites features.","triggerScenarios":"Calling any /stored/agents/:id/favorite endpoint (PUT toggle, GET list) on a Mastra server instance constructed without a storage option.","commonSituations":"Server bootstrapped with in-memory/no storage in development; storage config removed or never added; environment-specific config file not loading; using requireBuilderFeature('favorites') with favorites enabled but storage omitted.","solutions":["Configure storage when creating the Mastra instance: new Mastra({ storage: new MastraStorage(...) })","Verify the storage config file/env is actually loaded in the deployment","Use a real storage adapter (e.g. LibSQL, Postgres) instead of relying on defaults","If favorites aren't needed, disable the builder favorites feature rather than leaving endpoints half-configured"],"exampleFix":"// before\nnew Mastra({ agents })\n// after\nnew Mastra({ agents, storage: new MastraLibSQLStorage({ url: process.env.DATABASE_URL }) })","handlingStrategy":"validation","validationCode":"// At server startup\nconst storage = mastra.getStorage();\nif (!storage) throw new Error('Mastra server requires storage configuration for favorites features');","typeGuard":"function hasStorage(mastra: Mastra): boolean {\n  return mastra.getStorage() != null;\n}","tryCatchPattern":"try {\n  await client.toggleFavorite(agentId);\n} catch (e) {\n  if (e.status === 500 && /Storage is not configured/.test(e.message)) {\n    notifyAdmin('Favorites unavailable: server storage missing');\n  } else throw e;\n}","preventionTips":["Always configure storage in every Mastra server environment","Add a startup smoke test asserting storage resolves","Keep storage config in shared bootstrap code, not per-environment copies"],"tags":["storage","configuration","http-500"],"backgroundTag":"missing-storage-configuration","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}