mastra-ai/mastra · error

workflowDefinitions storage domain is not available.

Error message

workflowDefinitions storage domain is not available.

What it means

Even when storage is configured, mastracode must register the `workflowDefinitions` domain on it. workflowDefinitionsStore calls storage.getStore('workflowDefinitions') and throws this error if the domain is absent — meaning the storage backend is valid but does not expose the workflow-definitions store this service requires.

Source

Thrown at mastracode/sdk/src/workflows/service.ts:55

  result: Promise<unknown>;
}

interface WorkflowDefinitionsStore {
  list: (args?: { status?: 'active' | 'archived' }) => Promise<{ definitions: StoredWorkflowRow[]; total: number }>;
  get: (id: string) => Promise<StoredWorkflowRow | null>;
  delete: (id: string) => Promise<void>;
}

async function workflowDefinitionsStore(mastra: Mastra): Promise<WorkflowDefinitionsStore> {
  const storage = mastra.getStorage();
  if (!storage) throw new Error('Storage is not configured on the Mastra instance.');
  // `getStore` is a generic domain accessor; workflowDefinitions is registered
  // by mastracode. The domain shape is validated at boot; cast the resolved
  // store to the interface we exercise.
  const store = (await (storage as unknown as { getStore: (name: string) => Promise<unknown> }).getStore(
    'workflowDefinitions',
  )) as WorkflowDefinitionsStore | undefined;
  if (!store) throw new Error('workflowDefinitions storage domain is not available.');
  return store;
}

export async function listWorkflows(mastra: Mastra): Promise<{ workflows: StoredWorkflowRow[]; total: number }> {
  const store = await workflowDefinitionsStore(mastra);
  const result = await store.list({ status: 'active' });
  return { workflows: result.definitions, total: result.total };
}

export async function getWorkflow(mastra: Mastra, id: string): Promise<StoredWorkflowRow | null> {
  const store = await workflowDefinitionsStore(mastra);
  return store.get(id);
}

export async function deleteWorkflow(mastra: Mastra, id: string): Promise<{ ok: true; id: string }> {
  const store = await workflowDefinitionsStore(mastra);
  await store.delete(id);
  // Also unregister the live in-process Workflow instance so a subsequent

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Ensure mastracode's storage domain registration runs at boot (use the mastracode-provided storage wiring instead of a bare store)
  2. Check package versions so @mastra/core and mastracode agree on the domains API; upgrade to matching versions
  3. Verify with a quick probe that `await storage.getStore('workflowDefinitions')` resolves before calling service functions
Defensive patterns

Strategy: validation

Validate before calling

const storage = mastra.getStorage();
if (!storage) throw new Error('Storage not configured');
const store = await (storage as any).getStore?.('workflowDefinitions');
if (!store) throw new Error('workflowDefinitions domain missing — use the mastracode storage wiring and matching @mastra/core version');

Try / catch

try {
  const { workflows } = await listWorkflows(mastra);
} catch (e) {
  if (String(e.message).includes('workflowDefinitions storage domain')) {
    console.error('Check mastracode domain registration and @mastra/core version alignment.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling workflow service functions with a Mastra instance whose storage lacks the registered workflowDefinitions domain — e.g. a custom/partial storage implementation, an older core version without domain registration, or mastracode's domain registration skipped.

Common situations: Custom StorageAdapter that doesn't implement getStore for the domain; mismatched @mastra/core version where domain registration changed; boot-time registration failure silently swallowed elsewhere.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/eb819bddee15a08c. Report an issue: GitHub.