iflytek/astron-agent · error · CallThirdApiException

<dynamic request failure: str(err)>

Error message

<dynamic request failure: str(err)>

What it means

Any non-policy exception during request execution (aiohttp connection errors, timeouts, TLS failures, unexpected client errors) is caught by do_call's generic handler, recorded on the tracing span, and re-raised as CallThirdApiException using the error code/prefix appropriate for the API type (OFFICIAL_API_REQUEST_FAILED_ERR or THIRD_API_REQUEST_FAILED_ERR) with the original exception text in err.

Solutions

  1. Read err for the underlying exception message (e.g. 'Cannot connect to host ... Connection refused') and fix the network/endpoint cause
  2. Verify the tool endpoint host/port/DNS from inside the deployment (curl/ping from the same network)
  3. Add retry with backoff in the caller for transient network faults, or correct TLS/proxy configuration

Example fix

// before
code, prefix = ErrCode.THIRD_API_REQUEST_FAILED_ERR.code, ErrCode.THIRD_API_REQUEST_FAILED_ERR.msg
// after (caller-side retry for transient faults)
for attempt in range(3):
    try:
        return await run.do_call(span)
    except CallThirdApiException:
        if attempt == 2: raise
        await asyncio.sleep(2 ** attempt)
Defensive patterns

Strategy: retry

Validate before calling

import asyncio
async def with_retry(call, retries=3):
    for i in range(retries):
        try:
            return await call()
        except CallThirdApiException as e:
            if 'Cannot connect' not in str(e.err) or i == retries - 1:
                raise
            await asyncio.sleep(2 ** i)

Try / catch

try:
    result = await run.do_call(span)
except CallThirdApiException as e:
    if 'Cannot connect' in str(e.err) or 'Timeout' in str(e.err):
        raise TransientNetworkError(e.err) from e
    raise

Prevention

When it happens

Trigger: do_call → _execute_request raises e.g. aiohttp.ClientConnectorError (connection refused/DNS failure), ServerTimeoutError, ClientSSLError, or any other unexpected exception while performing the aiohttp request.

Common situations: Third-party API host down or unreachable from the cluster; egress firewall dropping the connection; wrong port; TLS certificate problems; network partition between link service and provider.

Related errors


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

Appendix: source

Thrown at core/plugin/link/infra/tool_exector/process.py:265

        with span.start(func_name="http_run") as span_context:
            try:
                third_result, status_code = await self._execute_request(
                    url, span_context
                )
            except CallThirdApiException:
                raise
            except OutboundPolicyError as err:
                span.add_error_event(str(err))
                raise CallThirdApiException(
                    code=ErrCode.SERVER_VALIDATE_ERR.code,
                    err_pre=ErrCode.SERVER_VALIDATE_ERR.msg,
                    err=str(err),
                ) from err
            except Exception as err:
                span.add_error_event(str(err))
                code_return, err_pre_return = self._get_error_codes()
                raise CallThirdApiException(
                    code=code_return, err_pre=err_pre_return, err=str(err)
                ) from err

        if status_code != 200:
            err_reason = (
                f"Request error code: {status_code}, error message {third_result}"
            )
            code_return, err_pre_return = self._get_error_codes()
            raise CallThirdApiException(
                code=code_return, err_pre=err_pre_return, err=err_reason
            )

        return third_result

    @staticmethod
    def is_authorization_md5(open_api_schema: Optional[Dict[str, Any]]) -> bool:
        """Check if the API uses MD5 authorization.

View on GitHub (pinned to 5e758547a8)