mastra-ai/mastra · critical · HTTPException

Storage is not configured

Error message

Storage is not configured

What it means

Listing prompt block versions requires persistent storage. If mastra.getStorage() returns undefined (no storage configured on the Mastra instance), the handler throws HTTP 500 'Storage is not configured'. Mastra features that persist data simply cannot function without a storage backend.

Source

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

 * GET /stored/prompt-blocks/:promptBlockId/versions - List all versions for a prompt block
 */
export const LIST_PROMPT_BLOCK_VERSIONS_ROUTE = createRoute({
  method: 'GET',
  path: '/stored/prompt-blocks/:promptBlockId/versions',
  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,

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure storage on the Mastra instance, e.g. new Mastra({ storage: new MastraLibsql({ url: 'file:./mastra.db' }) }).
  2. Verify the storage plugin/package is installed and imported in mastra/ config.
  3. In deployments, ensure the storage env vars (e.g. DATABASE_URL) are set.

Example fix

// before
export const mastra = new Mastra({ agents: { weatherAgent } });
// after
import { MastraLibsql } from '@mastra/libsql';
export const mastra = new Mastra({ agents: { weatherAgent }, storage: new MastraLibsql({ url: process.env.DATABASE_URL! }) });
Defensive patterns

Strategy: try-catch

Validate before calling

if (!mastra.getStorage()) {
  throw new Error('Configure storage on the Mastra instance before using prompt blocks');
}

Type guard

function hasStorage(m: Mastra): boolean {
  return Boolean(m.getStorage());
}

Try / catch

try {
  const versions = await client.getPromptBlockVersions(id);
} catch (e) {
  if (e.status === 500 && e.message === 'Storage is not configured') {
    console.error('Mastra instance has no storage; configure MastraStorage to use prompt blocks');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: GET the prompt-block versions route on a Mastra instance constructed without a storage option (no MastraStorage passed), so getStorage() is undefined.

Common situations: Dev servers started with only models/agents configured; in-memory prototypes promoted to features needing persistence; deployment configs missing DATABASE_URL or equivalent storage wiring.

Related errors


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