{"record":{"id":"eca0b5472f454cfc","repo":"mastra-ai/mastra","slug":"version-with-id-to-not-found-for-mcp-client-m","errorCode":null,"errorMessage":"Version with id ${to} not found for MCP client ${mcpClientId}","messagePattern":"Version with id (.+?) not found for MCP client (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"packages/server/src/server/handlers/mcp-client-versions.ts","lineNumber":478,"sourceCode":"      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\n      return {\n        diffs,\n        fromVersion,","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/mcp-client-versions.ts#L460-L496","documentation":"The 'to' version exists but belongs to a different MCP client than the one in the path, so the handler throws a 404 scoped to the client. Cross-client comparisons are rejected.","triggerScenarios":"GET /stored/mcp-clients/:mcpClientId/versions/compare?from=<id>&to=<id> where to belongs to another MCP client (from matched correctly).","commonSituations":"Aggregate scripts comparing 'latest of client A' vs 'latest of client B'; dashboard widgets caching to-ids from other clients; partially edited URL query strings.","solutions":["Use a to id owned by the path's mcpClientId.","Refetch version lists per client before building compare requests.","If cross-client comparison is truly needed, fetch both clients' configs and diff them client-side."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const to = versions.find(v => v.id === toId);\nif (to?.mcpClientId !== clientId) throw new Error('to version belongs to a different MCP client');","typeGuard":null,"tryCatchPattern":"try { await compare(from, to); } catch (e) { if (e.status === 404 && /not found for MCP client/.test(e.message)) { /* correct client scope */ } else throw e; }","preventionTips":["Derive both compare ids from a single per-client versions fetch","Clear cached compare targets when switching clients","For cross-client diffs, fetch each client separately and diff locally"],"tags":["http-404","ownership-mismatch","versioning","rest-api"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}