{"record":{"id":"361fdc9560210772","repo":"iflytek/astron-agent","slug":"40024-failed-to-execute-link-tool","errorCode":"40024","errorMessage":"Failed to execute link tool","messagePattern":"Failed to execute link tool","errorType":"exception","errorClass":"PluginExc","httpStatus":null,"severity":"error","filePath":"core/agent/service/plugin/link.py","lineNumber":180,"sourceCode":"                        response.raise_for_status()\n                        if response.status == 200:\n                            result = await response.json()\n                            sp.add_info_events(\n                                attributes={\n                                    \"link-plugin-run-outputs\": json.dumps(\n                                        result, ensure_ascii=False\n                                    )\n                                }\n                            )\n                        else:\n                            sp.add_info_events(\n                                attributes={\n                                    \"link-plugin-run-outputs\": (\n                                        f\"response code is {response.status}\"\n                                    )\n                                }\n                            )\n                            raise RunToolExc\n            except asyncio.TimeoutError as e:\n                raise RunToolExc from e\n\n            end_time = int(round(time.time() * 1000))\n            plugin_response = PluginResponse(\n                code=result.get(\"header\", {}).get(\"code\", -1),\n                sid=result.get(\"header\", {}).get(\"sid\", \"\"),\n                start_time=start_time,\n                end_time=end_time,\n                result=result,\n                log=[\n                    {\n                        \"name\": self.operation_id,\n                        \"input\": callback_payload,\n                        \"output\": result,\n                    }\n                ],\n            )","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/service/plugin/link.py#L162-L198","documentation":"run() raises bare RunToolExc (default code 40024, message \"Failed to execute link tool\") when the POST to RUN_LINK_URL returns a non-200 status (logged as \"link-plugin-run-outputs: response code is N\"), or when the call times out (asyncio.TimeoutError re-raised). It is the generic wrapper for link-execution HTTP failure.","triggerScenarios":"aiohttp POST to RUN_LINK_URL yields response.status != 200 after parsing, or the request exceeds LINK_CALL_TIMEOUT (default 90s) and TimeoutError is converted (link.py:158-183).","commonSituations":"Link/RPA service returning 4xx/5xx (bad task params, service crash, auth failure); slow remote-control session exceeding 90s; link service restarted mid-execution; gateway rejecting large payloads.","solutions":["Read the trace attribute link-plugin-run-outputs to get the exact response status and fix the upstream cause","Confirm the link service is healthy and RUN_LINK_URL targets the correct run endpoint","Increase LINK_CALL_TIMEOUT for legitimately long-running RPA sessions","Add retry with backoff for transient failures and validate task parameters before dispatch"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import aiohttp\nasync with aiohttp.ClientSession() as s:\n    async with s.head(run_url) as r:\n        assert r.status < 500, f\"link service unhealthy: {r.status}\"","typeGuard":"def is_link_success_response(status: int, result: dict) -> bool:\n    return status == 200 and isinstance(result, dict) and result.get(\"header\", {}).get(\"code\") == 0","tryCatchPattern":"for attempt in range(3):\n    try:\n        return await plugin.run(span)\n    except RunToolExc:\n        if attempt == 2:\n            logger.exception(\"link tool execution failed after retries\")\n            raise\n        await asyncio.sleep(2 ** attempt)","preventionTips":["Read the link-plugin-run-outputs span attribute for the exact upstream status","Set LINK_CALL_TIMEOUT above expected RPA session duration","Monitor link-service error rates and alert","Validate tool parameters before dispatching to the link service"],"tags":["network","plugin","rpa"],"backgroundTag":"http-error-response","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}