{"record":{"id":"d6a129c39267b002","repo":"mastra-ai/mastra","slug":"version-with-id-to-not-found-d6a129","errorCode":null,"errorMessage":"Version with id ${to} not found","messagePattern":"Version with id (.+?) not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/mcp-client-versions.ts","lineNumber":475,"sourceCode":"      if (!mcpClientStore) {\n        throw new HTTPException(500, { message: 'MCP clients storage domain is not available' });\n      }\n      const mcpClient = await mcpClientStore.getById(mcpClientId);\n      assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n      const fromVersion = await mcpClientStore.getVersion(from);\n      if (!fromVersion) {\n        throw new HTTPException(404, { message: `Version with id ${from} not found` });\n      }\n      if (fromVersion.mcpClientId !== mcpClientId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${from} not found for MCP client ${mcpClientId}`,\n        });\n      }\n\n      const toVersion = await mcpClientStore.getVersion(to);\n      if (!toVersion) {\n        throw new HTTPException(404, { message: `Version with id ${to} not found` });\n      }\n      if (toVersion.mcpClientId !== mcpClientId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${to} not found for MCP client ${mcpClientId}`,\n        });\n      }\n\n      const fromConfig = extractConfigFromVersion(\n        fromVersion as unknown as Record<string, unknown>,\n        MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n      );\n      const toConfig = extractConfigFromVersion(\n        toVersion as unknown as Record<string, unknown>,\n        MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,\n      );\n\n      const diffs = computeVersionDiffs(fromConfig, toConfig);\n","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/mcp-client-versions.ts#L457-L493","documentation":"The compare handler resolves the 'to' version via mcpClientStore.getVersion(to); when absent it throws HTTPException 404. The 'from' version was found but the 'to' target does not exist.","triggerScenarios":"GET /stored/mcp-clients/:mcpClientId/versions/compare?from=<id>&to=<id> where the to id is missing from storage.","commonSituations":"Comparing to a future/newer version id that hasn't been created yet; typo in the to param; stale UI pointing at a since-deleted version.","solutions":["Pick a to id from the client's actual version list endpoint.","Swap from/to if you intended to compare in the other direction using an existing id.","Verify ids were not truncated/transformed by URL encoding."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { versions } = await (await fetch(`/api/stored/mcp-clients/${clientId}/versions`)).json();\nif (!versions.some(v => v.id === toId)) throw new Error(`to version ${toId} not found`);","typeGuard":null,"tryCatchPattern":"try { await compare(from, to); } catch (e) { if (e.status === 404 && new RegExp(toId).test(e.message)) { /* pick a valid to id */ } else throw e; }","preventionTips":["Validate both from and to against the current version list","Guard against comparing to versions newer than the latest created","Encode ids correctly in query strings"],"tags":["http-404","storage","versioning","query-params"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}