{"record":{"id":"935a2369172a14b5","repo":"mastra-ai/mastra","slug":"version-with-id-from-not-found-for-mcp-client","errorCode":null,"errorMessage":"Version with id ${from} 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":468,"sourceCode":"      const storage = mastra.getStorage();\n\n      if (!storage) {\n        throw new HTTPException(500, { message: 'Storage is not configured' });\n      }\n\n      const mcpClientStore = await storage.getStore('mcpClients');\n      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      );","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/mcp-client-versions.ts#L450-L486","documentation":"The 'from' version exists but its mcpClientId differs from the path's mcpClientId, so the handler throws a 404 scoped to the client. This prevents comparing versions across different MCP clients.","triggerScenarios":"GET /stored/mcp-clients/:mcpClientId/versions/compare?from=<id>&to=<id> where from belongs to another MCP client.","commonSituations":"Scripts iterating multiple clients that reuse a single versions list; copy-pasted compare URLs mixing clients; UI state carrying a from-selection across a client switch.","solutions":["Pass both from and to ids belonging to the same mcpClientId as in the path.","Re-fetch each client's version list when switching clients in the UI.","Assert version.mcpClientId matches before issuing the compare request."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const from = versions.find(v => v.id === fromId);\nif (from?.mcpClientId !== clientId) throw new Error('from 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)) { /* use ids owned by this client */ } else throw e; }","preventionTips":["Scope version lists per client and never merge them","Reset selection state when switching clients","Assert parent ownership before cross-referencing ids"],"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"}