mastra-ai/mastra · error · HTTPException
Version with id ${from} not found for MCP client ${mcpClient
Error message
Version with id ${from} not found for MCP client ${mcpClientId} What it means
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.
Source
Thrown at packages/server/src/server/handlers/mcp-client-versions.ts:468
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(
fromVersion as unknown as Record<string, unknown>,
MCP_CLIENT_SNAPSHOT_CONFIG_FIELDS,
);View on GitHub (pinned to 75dd419e61)
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.
Defensive patterns
Strategy: validation
Validate before calling
const from = versions.find(v => v.id === fromId);
if (from?.mcpClientId !== clientId) throw new Error('from version belongs to a different MCP client'); Try / catch
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; } Prevention
- Scope version lists per client and never merge them
- Reset selection state when switching clients
- Assert parent ownership before cross-referencing ids
When it happens
Trigger: GET /stored/mcp-clients/:mcpClientId/versions/compare?from=<id>&to=<id> where from belongs to another MCP client.
Common situations: 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.
Related errors
- Version with id ${to} not found for MCP client ${mcpClientId
- Model "${modelId}" is not available. Available models: ${ids
- ACP connection is not initialized
- Model "${this.options.model}" is not available. Available mo
- ClaudeSDKAgent resumeData must include either sessionId or c
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/935a2369172a14b5.
Report an issue: GitHub.