{"record":{"id":"a8e11c8857eb55e9","repo":"mastra-ai/mastra","slug":"storage-is-not-configured-a8e11c","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/dynamic-workflows.ts","lineNumber":37,"sourceCode":" *\n * Mirrors `LIST_STORED_AGENTS_ROUTE` but without favorites/visibility/authorship\n * scoping (which the workflow-definitions domain doesn't carry in v1).\n */\nexport const LIST_DYNAMIC_WORKFLOWS_ROUTE = createRoute({\n  method: 'GET',\n  path: '/stored/workflows',\n  responseType: 'json',\n  queryParamSchema: listDynamicWorkflowsQuerySchema,\n  responseSchema: listDynamicWorkflowsResponseSchema,\n  summary: 'List dynamic workflow definitions',\n  description: 'Returns workflow definitions persisted to storage. Filterable by status and authorId.',\n  tags: ['Dynamic Workflows'],\n  requiresAuth: true,\n  requiresPermission: 'stored-workflows:read',\n  handler: async ({ mastra, status, authorId }) => {\n    try {\n      const storage = mastra.getStorage();\n      if (!storage) throw new HTTPException(500, { message: 'Storage is not configured' });\n\n      const store = await storage.getStore('workflowDefinitions');\n      if (!store) throw new HTTPException(500, { message: 'workflowDefinitions storage domain is not available' });\n\n      const result = await store.list({ status: status ?? 'active', authorId });\n      return { workflows: result.definitions, total: result.total };\n    } catch (error) {\n      return handleError(error, 'Error listing dynamic workflows');\n    }\n  },\n});\n\n/**\n * GET /stored/workflows/:dynamicWorkflowId — get one dynamic workflow.\n */\nexport const GET_DYNAMIC_WORKFLOW_ROUTE = createRoute({\n  method: 'GET',\n  path: '/stored/workflows/:dynamicWorkflowId',","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/dynamic-workflows.ts#L19-L55","documentation":"The dynamic-workflows list route requires a storage adapter on the Mastra instance. mastra.getStorage() returns undefined when no storage was configured, so the handler throws an HTTPException 500 'Storage is not configured'. Dynamic workflow definitions are persisted in storage, so the endpoint cannot function without it.","triggerScenarios":"GET /api/dynamic-workflows (list stored workflows) against a Mastra instance constructed without a storage option (e.g. `new Mastra({...})` with no `storage:` key, or storage removed during refactor).","commonSituations":"Local/dev Mastra instances with no database configured, deployments where storage env vars (e.g. DATABASE_URL / Upstash / LibSQL URL) are missing so storage is skipped, or examples migrated to the new Mastra constructor forgetting the storage field.","solutions":["Configure storage on the Mastra instance: pass `storage: new MastraStorage(...)` (LibSQL/Postgres/Upstash etc.) in the constructor","Verify storage-related env vars are set in the deployment environment","If storage is intentionally absent, do not call the dynamic-workflows routes","Add a startup check that warns when getStorage() is undefined but workflow routes are served"],"exampleFix":"// before\nexport const mastra = new Mastra({ agents, workflows });\n// after\nexport const mastra = new Mastra({\n  agents,\n  workflows,\n  storage: new LibSQLStore({ url: process.env.DATABASE_URL! }),\n});","handlingStrategy":"validation","validationCode":"const storage = mastra.getStorage();\nif (!storage) throw new Error('Configure storage on the Mastra instance before using dynamic workflows');","typeGuard":"function hasStorage(mastra: Mastra): boolean {\n  return typeof mastra.getStorage === 'function' && mastra.getStorage() != null;\n}","tryCatchPattern":"try {\n  const res = await fetch('/api/dynamic-workflows');\n  if (res.status === 500) throw new Error('Server storage not configured — set storage on Mastra instance');\n  return res.json();\n} catch (err) {\n  logger.error({ err }, 'list dynamic workflows failed');\n}","preventionTips":["Always pass `storage` in the Mastra constructor in production code","Assert storage env vars (e.g. DATABASE_URL) at process startup","Check `mastra.getStorage()` in a boot-time health check"],"tags":["server","storage","configuration","dynamic-workflows"],"backgroundTag":"storage-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}