paperclipai/paperclip · error · ToolGatewayHttpError
run_agent_mismatch
run_agent_mismatch
Error message
Run does not belong to agent
What it means
Ownership guard following the company check: the run exists in the right company but belongs to a different agent than the caller. Prevents agents from reading or attaching to other agents' runs; the mismatched agentId/run pair is at fault.
Source
Thrown at server/src/services/tool-gateway.ts:1084
catalogEntryId: catalogEntry.id,
transport: connection.transport,
gatewayToolName,
upstreamToolName: catalogEntry.toolName,
catalogName: catalogEntry.name,
inputSchema,
outputSchema,
annotations,
risk: {
level: catalogEntry.riskLevel,
isReadOnly: catalogEntry.isReadOnly,
isWrite: catalogEntry.isWrite,
isDestructive: catalogEntry.isDestructive,
},
onDemandTools,
};
return {
name: gatewayToolName,
displayName: catalogEntry.title ?? catalogEntry.toolName,
description: catalogEntry.description ?? `Connected MCP tool ${catalogEntry.toolName} from ${connection.name}.`,
parametersSchema: inputSchema,
pluginId: `mcp:${applicationKey ?? application.id}`,
providerType: connection.transport === "local_stdio" ? "mcp_local_stdio" : "mcp_remote_http",
risk,
applicationId: application.id,
applicationKey,
applicationDisplayName: application.name,
connectionId: connection.id,
catalogEntryId: catalogEntry.id,
upstreamToolName: catalogEntry.toolName,
providerMetadata,
};
});
}
async function connectedMcpToolsForConnection(companyId: string, connectionId: string): Promise<ToolGatewayDescriptor[]> {
return (await connectedMcpToolsForCompany(companyId))View on GitHub (pinned to 01ad858492)
Solutions
- Use a run that belongs to the calling agent; an agent cannot act on runs of other agents.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/tool-gateway.ts:1066 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/54e4be9770bc2474.
Report an issue: GitHub.