mastra-ai/mastra · error · HTTPException

Version with id ${from} not found

Error message

Version with id ${from} not found

What it means

The compare handler resolves the 'from' version via mcpClientStore.getVersion(from); if the store returns nothing it throws HTTPException 404. It means no version with that id exists for comparison.

Source

Thrown at packages/server/src/server/handlers/mcp-client-versions.ts:465

  tags: ['MCP Client Versions'],
  handler: async ({ mastra, mcpClientId, from, to, requestContext }) => {
    try {
      const storage = mastra.getStorage();

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

      const mcpClientStore = await storage.getStore('mcpClients');
      if (!mcpClientStore) {
        throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });
      }
      const mcpClient = await mcpClientStore.getById(mcpClientId);
      assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));

      const fromVersion = await mcpClientStore.getVersion(from);
      if (!fromVersion) {
        throw new HTTPException(404, { message: `Version with id ${from} not found` });
      }
      if (fromVersion.mcpClientId !== mcpClientId) {
        throw new HTTPException(404, {
          message: `Version with id ${from} not found for MCP client ${mcpClientId}`,
        });
      }

      const toVersion = await mcpClientStore.getVersion(to);
      if (!toVersion) {
        throw new HTTPException(404, { message: `Version with id ${to} not found` });
      }
      if (toVersion.mcpClientId !== mcpClientId) {
        throw new HTTPException(404, {
          message: `Version with id ${to} not found for MCP client ${mcpClientId}`,
        });
      }

      const fromConfig = extractConfigFromVersion(

View on GitHub (pinned to 75dd419e61)

Solutions

  1. List the client's versions (GET /stored/mcp-clients/:id/versions) and pick a valid from id.
  2. Correct the query parameter value; ensure both from and to exist.
  3. Check you're pointing at the same storage backend used when the versions were recorded.

Example fix

// before
fetch(`/api/stored/mcp-clients/${id}/versions/compare?from=${deletedId}&to=${toId}`)
// after
const { versions } = await (await fetch(`/api/stored/mcp-clients/${id}/versions`)).json();
const from = versions.find(v => v.versionNumber === 2)?.id;
fetch(`/api/stored/mcp-clients/${id}/versions/compare?from=${from}&to=${toId}`)
Defensive patterns

Strategy: validation

Validate before calling

const { versions } = await (await fetch(`/api/stored/mcp-clients/${clientId}/versions`)).json();
if (!versions.some(v => v.id === fromId)) throw new Error(`from version ${fromId} not found`);

Try / catch

try { await compare(from, to); } catch (e) { if (e.status === 404) { const fresh = await listVersions(); /* retry with valid ids */ } else throw e; }

Prevention

When it happens

Trigger: GET /stored/mcp-clients/:mcpClientId/versions/compare?from=<id>&to=<id> where the from id is missing from storage (deleted, wrong backend, typo).

Common situations: Comparing against a version that was already cleaned up; stale links/bookmarks in the UI; querying a storage instance different from where versions were created.

Related errors


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