{"record":{"id":"c53ad0d0f8be776a","repo":"mastra-ai/mastra","slug":"version-with-id-versionid-not-found-c53ad0","errorCode":null,"errorMessage":"Version with id ${versionId} 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":196,"sourceCode":"  description: 'Returns a specific version of an MCP client by its version ID',\n  tags: ['MCP Client Versions'],\n  handler: async ({ mastra, mcpClientId, versionId, requestContext }) => {\n    try {\n      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\n      const version = await mcpClientStore.getVersion(versionId);\n\n      if (!version) {\n        throw new HTTPException(404, { message: `Version with id ${versionId} not found` });\n      }\n\n      if (version.mcpClientId !== mcpClientId) {\n        throw new HTTPException(404, {\n          message: `Version with id ${versionId} not found for MCP client ${mcpClientId}`,\n        });\n      }\n      const mcpClient = await mcpClientStore.getById(mcpClientId);\n      assertStoredResourceScope(mcpClient, await getStoredResourceScope(mastra, requestContext));\n\n      return version;\n    } catch (error) {\n      return handleError(error, 'Error getting MCP client version');\n    }\n  },\n});\n\n/**","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/server/src/server/handlers/mcp-client-versions.ts#L178-L214","documentation":"This 404 is thrown when mcpClientStore.getVersion(versionId) returns null, meaning no stored version exists with that id. The endpoint treats a missing version as 404 for the version resource.","triggerScenarios":"Calling GET an MCP client version endpoint with a versionId that does not exist in storage (already pruned by retention, never created, or mistyped).","commonSituations":"A retention limit job deleted old versions the caller still references; the caller uses a version id from another MCP client or environment; ids copied from logs that were truncated.","solutions":["List the versions for the MCP client first and use an id from that list","Check that retention settings did not prune the version","Verify the versionId against the storage backend directly","Correct any typo in the path parameter"],"exampleFix":"// before\nawait fetch(`/api/mcp-clients/${clientId}/versions/${'v_bad'}`)\n// after\nconst versions = await fetch(`/api/mcp-clients/${clientId}/versions`).then(r => r.json());\nawait fetch(`/api/mcp-clients/${clientId}/versions/${versions[0].id}`)","handlingStrategy":"try-catch","validationCode":"const versions = await fetch(`/api/mcp-clients/${clientId}/versions`).then(r => r.json());\nif (!versions.some(v => v.id === versionId)) throw new Error(`Version ${versionId} does not exist for client ${clientId}`);","typeGuard":"function isKnownVersion(versions: { id: string }[], id: string): boolean {\n  return versions.some(v => v.id === id);\n}","tryCatchPattern":"try {\n  const res = await fetch(`/api/mcp-clients/${clientId}/versions/${versionId}`);\n  if (res.status === 404) {\n    // refresh version list; the version may have been pruned\n    return null;\n  }\n  return await res.json();\n} catch (err) {\n  // handle network/other failures\n}","preventionTips":["Always obtain versionIds from a fresh list call","Account for retention policies pruning old versions","Don't persist version ids longer than necessary"],"tags":["http-404","not-found","mcp","storage"],"backgroundTag":"resource-not-found-404","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}