mastra-ai/mastra · error · HTTPException
workflowDefinitions storage domain is not available
Error message
workflowDefinitions storage domain is not available
What it means
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'.
Source
Thrown at packages/server/src/server/handlers/dynamic-workflows.ts:40
*/
export const LIST_DYNAMIC_WORKFLOWS_ROUTE = createRoute({
method: 'GET',
path: '/stored/workflows',
responseType: 'json',
queryParamSchema: listDynamicWorkflowsQuerySchema,
responseSchema: listDynamicWorkflowsResponseSchema,
summary: 'List dynamic workflow definitions',
description: 'Returns workflow definitions persisted to storage. Filterable by status and authorId.',
tags: ['Dynamic Workflows'],
requiresAuth: true,
requiresPermission: 'stored-workflows:read',
handler: async ({ mastra, status, authorId }) => {
try {
const storage = mastra.getStorage();
if (!storage) throw new HTTPException(500, { message: 'Storage is not configured' });
const store = await storage.getStore('workflowDefinitions');
if (!store) throw new HTTPException(500, { message: 'workflowDefinitions storage domain is not available' });
const result = await store.list({ status: status ?? 'active', authorId });
return { workflows: result.definitions, total: result.total };
} catch (error) {
return handleError(error, 'Error listing dynamic workflows');
}
},
});
/**
* GET /stored/workflows/:dynamicWorkflowId — get one dynamic workflow.
*/
export const GET_DYNAMIC_WORKFLOW_ROUTE = createRoute({
method: 'GET',
path: '/stored/workflows/:dynamicWorkflowId',
responseType: 'json',
pathParamSchema: dynamicWorkflowIdPathParams,
responseSchema: getDynamicWorkflowResponseSchema,View on GitHub (pinned to 75dd419e61)
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
Example fix
// before
const store = await storage.getStore('workflowDefinitions');
// after — guard explicitly
const store = await storage.getStore('workflowDefinitions');
if (!store) throw new Error('Upgrade storage adapter: workflowDefinitions domain unsupported'); Defensive patterns
Strategy: validation
Validate before calling
const store = await storage.getStore('workflowDefinitions');
if (!store) throw new Error('Storage adapter does not implement workflowDefinitions — upgrade or switch backend'); Type guard
function hasWorkflowDefinitionsStore(s: Awaited<ReturnType<Mastra['getStorage']>>): boolean {
return !!s && typeof s.getStore === 'function' && !!s.getStore('workflowDefinitions');
} Try / catch
try {
const workflows = await fetch('/api/dynamic-workflows').then(r => {
if (r.status === 500) throw new Error('workflowDefinitions domain unavailable');
return r.json();
});
} catch (err) {
logger.error({ err }, 'workflowDefinitions store missing');
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Storage is not configured
- AcpAgent does not support resuming suspended generate calls
- AcpAgent does not support resuming suspended stream calls
- ACP prompt stopped before completing: ${response.stopReason}
- ClaudeSDKAgent resumeData must include a message.
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/1c9fa06f509d47f4.
Report an issue: GitHub.