{"record":{"id":"1c9fa06f509d47f4","repo":"mastra-ai/mastra","slug":"workflowdefinitions-storage-domain-is-not-availabl-1c9fa0","errorCode":null,"errorMessage":"workflowDefinitions storage domain is not available","messagePattern":"workflowDefinitions storage domain is not available","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"packages/server/src/server/handlers/dynamic-workflows.ts","lineNumber":40,"sourceCode":" */\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',\n  responseType: 'json',\n  pathParamSchema: dynamicWorkflowIdPathParams,\n  responseSchema: getDynamicWorkflowResponseSchema,","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/dynamic-workflows.ts#L22-L58","documentation":"Even when a storage adapter exists, the handler requires the `workflowDefinitions` storage domain (a store capability). `storage.getStore('workflowDefinitions')` resolves to undefined when the configured storage backend does not implement or register that domain, so the route throws HTTPException 500. This distinguishes 'no storage at all' from 'storage lacks this domain'.","triggerScenarios":"Listing dynamic workflows against a storage adapter that lacks the workflowDefinitions domain — e.g. a minimal/custom storage implementation, an older storage package version predating the domain, or an in-memory store that only registers subset domains.","commonSituations":"Custom storage adapters that don't implement all domains, version mismatch between @mastra/core and the storage package where the domain isn't yet supported, or class-based storage with the domain behind a flag/unsupported backend.","solutions":["Upgrade the storage package to a version that implements the workflowDefinitions domain","Switch to a fully-featured built-in storage backend (LibSQL, Postgres, Upstash)","If using a custom adapter, implement the workflowDefinitions store (list/get/delete for definitions)","Verify with a quick script that `await storage.getStore('workflowDefinitions')` returns a store"],"exampleFix":"// before\nconst store = await storage.getStore('workflowDefinitions');\n// after — guard explicitly\nconst store = await storage.getStore('workflowDefinitions');\nif (!store) throw new Error('Upgrade storage adapter: workflowDefinitions domain unsupported');","handlingStrategy":"validation","validationCode":"const store = await storage.getStore('workflowDefinitions');\nif (!store) throw new Error('Storage adapter does not implement workflowDefinitions — upgrade or switch backend');","typeGuard":"function hasWorkflowDefinitionsStore(s: Awaited<ReturnType<Mastra['getStorage']>>): boolean {\n  return !!s && typeof s.getStore === 'function' && !!s.getStore('workflowDefinitions');\n}","tryCatchPattern":"try {\n  const workflows = await fetch('/api/dynamic-workflows').then(r => {\n    if (r.status === 500) throw new Error('workflowDefinitions domain unavailable');\n    return r.json();\n  });\n} catch (err) {\n  logger.error({ err }, 'workflowDefinitions store missing');\n}","preventionTips":["Pin @mastra/core and storage package versions to compatible ranges","Prefer built-in storage backends that implement all domains","Probe getStore('workflowDefinitions') in integration tests"],"tags":["server","storage","storage-domain","dynamic-workflows"],"backgroundTag":"storage-domain-unavailable","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}