{"record":{"id":"ea6d463b2f6e54ee","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-ea6d46","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-skill-favorites.ts","lineNumber":17,"sourceCode":"import { HTTPException } from '../http-exception';\nimport { favoriteToggleResponseSchema } from '../schemas/favorites';\nimport { storedSkillIdPathParams } from '../schemas/stored-skills';\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 skillStore = await storage.getStore('skills');\n  if (!skillStore) {\n    throw new HTTPException(500, { message: 'Skills 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 { skillStore, favoritesStore };\n}\n\n/**\n * PUT /stored/skills/:storedSkillId/favorite\n */\nexport const FAVORITE_STORED_SKILL_ROUTE = createRoute({\n  method: 'PUT',\n  path: '/stored/skills/:storedSkillId/favorite',","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/stored-skill-favorites.ts#L1-L35","documentation":"Thrown by getFavoritesContext in stored-skill-favorites.ts when `mastra.getStorage()` returns falsy. The stored-skill favorite/unfavorite routes (PUT/DELETE /stored/skills/:id/favorite) need both the skills and favorites storage domains, so they fail fast with HTTP 500 when no storage is configured on the Mastra instance.","triggerScenarios":"Calling PUT or DELETE /api/stored/skills/:storedSkillId/favorite on a server whose Mastra instance has no storage configured — getFavoritesContext throws before resolving skillStore/favoritesStore (both agentStore and favoritesStore callers are affected).","commonSituations":"Mastra app deployed without a storage adapter; favorites feature enabled (requireBuilderFeature 'favorites' passes) but storage never wired; local dev runs fine in-memory, then production calls favorites endpoints and 500s; config refactor accidentally drops the `storage` option.","solutions":["Configure storage on the Mastra instance so `getStorage()` returns a store (Postgres/LibSQL/other official adapter).","Audit all code paths that construct Mastra (dev vs prod configs) to ensure the storage option is always present.","If favorites aren't needed, disable the builder favorites feature so these routes aren't exposed/called.","Add a startup check that logs/fails fast if a feature requiring storage is enabled without storage."],"exampleFix":"// before\nexport const mastra = new Mastra({ agents: myAgents });\n// after\nexport const mastra = new Mastra({\n  agents: myAgents,\n  storage: new LibSQLStore({ url: process.env.LIBSQL_URL }),\n});","handlingStrategy":"try-catch","validationCode":"// server-side guard before enabling favorites\nif (favoritesEnabled && !mastra.getStorage()) {\n  throw new Error('Favorites feature requires storage; configure Mastra storage or disable favorites');\n}","typeGuard":"function storageIsConfigured(mastra: { getStorage(): unknown }): mastra is { getStorage(): NonNullable<ReturnType<typeof mastra.getStorage>> } {\n  return !!mastra.getStorage();\n}","tryCatchPattern":"try {\n  const res = await fetch(`/api/stored/skills/${id}/favorite`, { method: 'PUT' });\n  if (res.status === 500) {\n    const body = await res.json().catch(() => ({}));\n    if (body?.message === 'Storage is not configured') {\n      console.error('Favorites require server storage — configure Mastra storage');\n      return;\n    }\n  }\n} catch (err) {\n  console.error('Favorite toggle failed:', err);\n}","preventionTips":["Never enable the builder favorites feature without also configuring storage.","Use one Mastra factory for all environments so storage can't be omitted accidentally.","Add an integration test that hits a favorites route against the real server config.","Fail fast at boot if required features are enabled but storage is missing."],"tags":["storage","configuration","http-500","favorites","server"],"backgroundTag":"storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}