iflytek/astron-agent · error · PluginExc

40024

40024

Error message

Failed to execute link tool

What it means

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.

Solutions

  1. Read the trace attribute link-plugin-run-outputs to get the exact response status and fix the upstream cause
  2. Confirm the link service is healthy and RUN_LINK_URL targets the correct run endpoint
  3. Increase LINK_CALL_TIMEOUT for legitimately long-running RPA sessions
  4. Add retry with backoff for transient failures and validate task parameters before dispatch
Defensive patterns

Strategy: retry

Validate before calling

import aiohttp
async with aiohttp.ClientSession() as s:
    async with s.head(run_url) as r:
        assert r.status < 500, f"link service unhealthy: {r.status}"

Type guard

def is_link_success_response(status: int, result: dict) -> bool:
    return status == 200 and isinstance(result, dict) and result.get("header", {}).get("code") == 0

Try / catch

for attempt in range(3):
    try:
        return await plugin.run(span)
    except RunToolExc:
        if attempt == 2:
            logger.exception("link tool execution failed after retries")
            raise
        await asyncio.sleep(2 ** attempt)

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/361fdc9560210772. Report an issue: GitHub.

Appendix: source

Thrown at core/agent/service/plugin/link.py:180

                        response.raise_for_status()
                        if response.status == 200:
                            result = await response.json()
                            sp.add_info_events(
                                attributes={
                                    "link-plugin-run-outputs": json.dumps(
                                        result, ensure_ascii=False
                                    )
                                }
                            )
                        else:
                            sp.add_info_events(
                                attributes={
                                    "link-plugin-run-outputs": (
                                        f"response code is {response.status}"
                                    )
                                }
                            )
                            raise RunToolExc
            except asyncio.TimeoutError as e:
                raise RunToolExc from e

            end_time = int(round(time.time() * 1000))
            plugin_response = PluginResponse(
                code=result.get("header", {}).get("code", -1),
                sid=result.get("header", {}).get("sid", ""),
                start_time=start_time,
                end_time=end_time,
                result=result,
                log=[
                    {
                        "name": self.operation_id,
                        "input": callback_payload,
                        "output": result,
                    }
                ],
            )

View on GitHub (pinned to 5e758547a8)