iflytek/astron-agent · error · CallThirdApiException

Request error code: , error message

Error message

Request error code: {status_code}, error message {third_result}

What it means

After the HTTP request completes, do_call checks the response status. Any status other than 200 — including 2xx redirects-suppressed codes, 4xx client errors and 5xx server errors — raises CallThirdApiException whose err field contains 'Request error code: {status}, error message {body}'. The code/prefix reflect whether the tool is official or third-party. Note the library treats only exactly 200 as success.

Solutions

  1. Read the status code and provider message in err and address the specific cause (fix credentials for 401/403, fix path/body for 400/404, back off for 429/5xx)
  2. Verify API keys, HMAC app_id/api_key/api_secret environment variables and that server clocks are synchronized (NTP) for signed requests
  3. Compare the actual request URL/body in the trace span against the provider's API documentation
Defensive patterns

Strategy: try-catch

Try / catch

try:
    result = await run.do_call(span)
except CallThirdApiException as e:
    m = re.search(r'Request error code: (\d+)', str(e.err))
    if m:
        status = int(m.group(1))
        if status in (429, 500, 502, 503, 504):
            schedule_retry(status)
        elif status in (401, 403):
            rotate_credentials()
    raise

Prevention

When it happens

Trigger: do_call receives a response with status like 401 (bad/missing auth credentials or expired signature), 404 (wrong path/placeholder), 429 (rate limited), or 500 from the third-party API. Note that HMAC-signed URLs are time-sensitive, so clock skew produces 401.

Common situations: Expired or wrong API keys / HMAC secrets; malformed request body rejected by provider; endpoint template mismatch causing 404; provider rate limiting or outage; server clock drift invalidating date-based HMAC signatures.

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/a0d740a5d62ce956. Report an issue: GitHub.

Appendix: source

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

                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.

        Args:
            open_api_schema: OpenAPI schema definition

        Returns:
            bool: True if MD5 authorization is used
        """
        if open_api_schema:
            paths = open_api_schema.get("paths", {})
            for _, get_dict in paths.items():

View on GitHub (pinned to 5e758547a8)