mastra-ai/mastra · critical · HTTPException

Prompt blocks storage domain is not available

Error message

Prompt blocks storage domain is not available

What it means

Storage exists but does not expose the 'promptBlocks' domain store: storage.getStore('promptBlocks') returned undefined, so the handler throws HTTP 500. Some storage adapters implement only a subset of Mastra's storage domains.

Source

Thrown at packages/server/src/server/handlers/prompt-block-versions.ts:55

  requiresAuth: true,
  responseType: 'json',
  pathParamSchema: promptBlockVersionPathParams,
  queryParamSchema: listPromptBlockVersionsQuerySchema,
  responseSchema: listPromptBlockVersionsResponseSchema,
  summary: 'List prompt block versions',
  description: 'Returns a paginated list of all versions for a stored prompt block',
  tags: ['Prompt Block Versions'],
  handler: async ({ mastra, promptBlockId, page, perPage, orderBy, 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 promptBlock = await promptBlockStore.getById(promptBlockId);
      if (!promptBlock) {
        throw new HTTPException(404, { message: `Prompt block with id ${promptBlockId} not found` });
      }
      assertStoredResourceScope(promptBlock, await getStoredResourceScope(mastra, requestContext));

      const result = await promptBlockStore.listVersions({
        blockId: promptBlockId,
        page,
        perPage,
        orderBy,
      });

      return result;
    } catch (error) {
      return handleError(error, 'Error listing prompt block versions');

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Upgrade the storage package to a version implementing the promptBlocks domain.
  2. Switch to a fully featured adapter (e.g. LibSQL/Postgres storage) that supports promptBlocks.
  3. If using a custom storage class, implement the promptBlocks store methods (getById, listVersions, etc.).

Example fix

// before
storage: new MastraMemoryStorage() // no promptBlocks domain
// after
storage: new MastraLibsql({ url: 'file:./mastra.db' }) // implements all domains incl. promptBlocks
Defensive patterns

Strategy: try-catch

Validate before calling

const storage = mastra.getStorage();
if (storage && !(await storage.getStore('promptBlocks'))) {
  throw new Error('Storage adapter does not implement the promptBlocks domain');
}

Try / catch

try {
  await client.getPromptBlockVersions(id);
} catch (e) {
  if (e.status === 500 && e.message.includes('storage domain is not available')) {
    console.error('Upgrade/swap the storage adapter to one implementing promptBlocks');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the prompt-block versions route with a storage adapter that has not implemented the promptBlocks store (getStore('promptBlocks') === undefined).

Common situations: Using a minimal or older storage adapter lacking newer domains; custom MastraStorage implementations that skipped promptBlocks; version skew between @mastra/core and the storage package.

Related errors


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