paperclipai/paperclip · error · ToolGatewayHttpError

actor_agent_mismatch

actor_agent_mismatch

Error message

Agent cannot execute tools as another agent

What it means

executePluginTool identity guard: the agent actor's id does not match the agentId in the run context, so one agent is attempting to execute plugin tools attributed to another agent. The 403 preserves per-agent attribution and audit integrity for plugin tool calls.

Solutions

  1. Execute tools only as the authenticated agent; impersonating another agent is rejected.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/services/tool-gateway.ts:6032 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-09-18). Data as JSON: /api/errors/e6c50c64db056252. Report an issue: GitHub.

Appendix: source

Thrown at server/src/services/tool-gateway.ts:10532

    async executePluginTool(input: ExecutePluginToolInput) {
      if (!pluginToolDispatcher) {
        throw new ToolGatewayHttpError(
          501,
          "Plugin tool dispatch is not enabled",
          "plugin_tools_disabled",
        );
      }
      if (input.actor.type === "agent") {
        if (input.actor.companyId !== input.runContext.companyId) {
          throw new ToolGatewayHttpError(
            403,
            "Agent key cannot access another company",
            "actor_company_mismatch",
          );
        }
        if (input.actor.agentId !== input.runContext.agentId) {
          throw new ToolGatewayHttpError(
            403,
            "Agent cannot execute tools as another agent",
            "actor_agent_mismatch",
          );
        }
        if (input.actor.runId && input.actor.runId !== input.runContext.runId) {
          throw new ToolGatewayHttpError(
            403,
            "Agent cannot execute tools for another run",
            "actor_run_mismatch",
          );
        }
      }

      const context = await resolveRunContext({
        companyId: input.runContext.companyId,
        agentId: input.runContext.agentId,
        runId: input.runContext.runId,

View on GitHub (pinned to 3f1d897a7c)