{"record":{"id":"31c41c16ea73ced9","repo":"paperclipai/paperclip","slug":"tool-execution-failed","errorCode":"tool_execution_failed","errorMessage":"Approved tool action failed","messagePattern":"Approved tool action failed","errorType":"http","errorClass":"ToolGatewayHttpError","httpStatus":502,"severity":"error","filePath":"server/src/services/tool-gateway.ts","lineNumber":4311,"sourceCode":"      // onto a loopback or metadata address between validation and dispatch\n      // (PAP-17098).\n      const requestInit: RequestInit = {\n        method: \"POST\",\n        redirect: \"manual\",\n        // MCP Streamable HTTP requires the Accept header advertising both a JSON\n        // body and an SSE stream; spec-compliant servers 406 without it.\n        headers: mcpHttpRequestHeaders(requestHeaders),\n        signal: controller.signal,\n        body: JSON.stringify({\n          jsonrpc: \"2.0\",\n          id: requestId,\n          method: \"tools/call\",\n          params: {\n            name: entry.toolName,\n            arguments: parameters,\n          },\n        }),\n      };\n      let response = await dispatchRemote(endpoint, requestInit);\n      if (response.status === 401 && composioChild) {\n        composioSession = await composioSessions.ensureSession(connection.id, {\n          tools: [entry.toolName],\n          scopeRevision: composioScopeRevision,\n          force: true,\n        });\n        endpoint = composioSession.url;\n        credentialHeaders = composioSession.headers;\n        builtHeaders = buildRemoteHeaders({ session, connection, credentialHeaders, callerHeaders });\n        headers = builtHeaders.headers;\n        headerSummary = builtHeaders.summary;\n        const retryInit = { ...requestInit, headers: mcpHttpRequestHeaders(headers) };\n        response = await dispatchRemote(endpoint, retryInit);\n      }\n      const oauth = asRecord(asRecord(connection.config)?.oauth);\n      if (\n        response.status === 401","sourceCodeStart":4293,"sourceCodeEnd":4329,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/tool-gateway.ts#L4293-L4329","documentation":"Reported when an approved tool action finished with status failed and no invocation errorMessage was stored: the gateway returns the settled invocation's error text, falling back to this generic 'Approved tool action failed' 502. It means execution was attempted after approval and the tool itself errored; inspect the invocation/events for the root cause.","triggerScenarios":"Thrown at server/src/services/tool-gateway.ts:4170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The approved action failed during execution. Inspect the execution error details and fix the underlying tool/input problem before retrying with a new approval."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}