{"record":{"id":"e6c50c64db056252","repo":"paperclipai/paperclip","slug":"actor-agent-mismatch","errorCode":"actor_agent_mismatch","errorMessage":"Agent cannot execute tools as another agent","messagePattern":"Agent cannot execute tools as another agent","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":403,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":10532,"sourceCode":"\n    async executePluginTool(input: ExecutePluginToolInput) {\n      if (!pluginToolDispatcher) {\n        throw new ToolGatewayHttpError(\n          501,\n          \"Plugin tool dispatch is not enabled\",\n          \"plugin_tools_disabled\",\n        );\n      }\n      if (input.actor.type === \"agent\") {\n        if (input.actor.companyId !== input.runContext.companyId) {\n          throw new ToolGatewayHttpError(\n            403,\n            \"Agent key cannot access another company\",\n            \"actor_company_mismatch\",\n          );\n        }\n        if (input.actor.agentId !== input.runContext.agentId) {\n          throw new ToolGatewayHttpError(\n            403,\n            \"Agent cannot execute tools as another agent\",\n            \"actor_agent_mismatch\",\n          );\n        }\n        if (input.actor.runId && input.actor.runId !== input.runContext.runId) {\n          throw new ToolGatewayHttpError(\n            403,\n            \"Agent cannot execute tools for another run\",\n            \"actor_run_mismatch\",\n          );\n        }\n      }\n\n      const context = await resolveRunContext({\n        companyId: input.runContext.companyId,\n        agentId: input.runContext.agentId,\n        runId: input.runContext.runId,","sourceCodeStart":10514,"sourceCodeEnd":10550,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/services/tool-gateway.ts#L10514-L10550","documentation":"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.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:6032 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Execute tools only as the authenticated agent; impersonating another agent is rejected."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-09-18T08:03:59.046Z","contentChangedAt":"2026-09-18T08:03:59.046Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}