mastra-ai/mastra · error · HTTPException

Prompt blocks storage domain is not available

Error message

Prompt blocks storage domain is not available

What it means

Storage exists but getStore('promptBlocks') returned null, meaning the configured storage adapter does not provide the promptBlocks domain. The server throws HTTP 500 because it cannot enumerate prompt blocks without that domain store.

Source

Thrown at packages/server/src/server/handlers/stored-prompt-blocks.ts:64

  path: '/stored/prompt-blocks',
  responseType: 'json',
  queryParamSchema: listStoredPromptBlocksQuerySchema,
  responseSchema: listStoredPromptBlocksResponseSchema,
  summary: 'List stored prompt blocks',
  description: 'Returns a paginated list of all prompt blocks stored in the database',
  tags: ['Stored Prompt Blocks'],
  requiresAuth: true,
  handler: async ({ mastra, page, perPage, orderBy, status, authorId, metadata, requestContext }) => {
    try {
      const storage = mastra.getStorage();

      if (!storage) {
        throw new HTTPException(500, { message: 'Storage is not configured' });
      }

      const promptBlockStore = await storage.getStore('promptBlocks');
      if (!promptBlockStore) {
        throw new HTTPException(500, { message: 'Prompt blocks storage domain is not available' });
      }

      const scope = await getStoredResourceScope(mastra, requestContext);
      const result = await promptBlockStore.listResolved({
        page,
        perPage,
        orderBy,
        status,
        authorId,
        metadata: scopeStoredResourceMetadata(metadata, scope),
      });

      // For each block, fetch the latest version to compute hasDraft.
      // resolvedVersionId from listResolved defaults to 'published' resolution,
      // so we need the actual latest version to detect unpublished drafts.
      const promptBlocks = await Promise.all(
        result.promptBlocks.map(async (block: (typeof result.promptBlocks)[number]) => {
          const latestVersion = await promptBlockStore.getLatestVersion(block.id);

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Update the storage adapter and @mastra/core to the same latest version (pnpm why / lockfile check for skew)
  2. If custom, implement the promptBlocks domain in your storage class
  3. Verify with a script: const s = mastra.getStorage(); await s.getStore('promptBlocks') should be truthy
  4. Switch to an official adapter (libsql, pg, upstash) that ships all current domains
Defensive patterns

Strategy: validation

Validate before calling

const store = await mastra.getStorage()?.getStore('promptBlocks');
if (!store) throw new Error('promptBlocks domain missing from storage adapter — upgrade adapter');

Try / catch

try {
  const blocks = await store.listResolved({ page, perPage });
} catch (e) {
  if (/storage domain is not available/.test(String(e))) {
    // version skew: upgrade @mastra/core + storage adapter together
  }
}

Prevention

When it happens

Trigger: GET stored prompt blocks list against an adapter without promptBlocks support — usually version skew between @mastra/core server code and the installed storage package, or a custom storage implementation missing this newer domain.

Common situations: Recently added feature used with an older storage package; third-party adapters that implement only legacy domains; partial upgrades in a pnpm workspace where core updated but adapters pinned.

Related errors


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