{"record":{"id":"a0d740a5d62ce956","repo":"iflytek/astron-agent","slug":"request-error-code-status-code-error-message-third-result","errorCode":null,"errorMessage":"Request error code: {status_code}, error message {third_result}","messagePattern":"Request error code: (.+?), error message (.+?)","errorType":"http","errorClass":"CallThirdApiException","httpStatus":null,"severity":"error","filePath":"core/plugin/link/infra/tool_exector/process.py","lineNumber":274,"sourceCode":"                span.add_error_event(str(err))\n                raise CallThirdApiException(\n                    code=ErrCode.SERVER_VALIDATE_ERR.code,\n                    err_pre=ErrCode.SERVER_VALIDATE_ERR.msg,\n                    err=str(err),\n                ) from err\n            except Exception as err:\n                span.add_error_event(str(err))\n                code_return, err_pre_return = self._get_error_codes()\n                raise CallThirdApiException(\n                    code=code_return, err_pre=err_pre_return, err=str(err)\n                ) from err\n\n        if status_code != 200:\n            err_reason = (\n                f\"Request error code: {status_code}, error message {third_result}\"\n            )\n            code_return, err_pre_return = self._get_error_codes()\n            raise CallThirdApiException(\n                code=code_return, err_pre=err_pre_return, err=err_reason\n            )\n\n        return third_result\n\n    @staticmethod\n    def is_authorization_md5(open_api_schema: Optional[Dict[str, Any]]) -> bool:\n        \"\"\"Check if the API uses MD5 authorization.\n\n        Args:\n            open_api_schema: OpenAPI schema definition\n\n        Returns:\n            bool: True if MD5 authorization is used\n        \"\"\"\n        if open_api_schema:\n            paths = open_api_schema.get(\"paths\", {})\n            for _, get_dict in paths.items():","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/plugin/link/infra/tool_exector/process.py#L256-L292","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)","Verify API keys, HMAC app_id/api_key/api_secret environment variables and that server clocks are synchronized (NTP) for signed requests","Compare the actual request URL/body in the trace span against the provider's API documentation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    result = await run.do_call(span)\nexcept CallThirdApiException as e:\n    m = re.search(r'Request error code: (\\d+)', str(e.err))\n    if m:\n        status = int(m.group(1))\n        if status in (429, 500, 502, 503, 504):\n            schedule_retry(status)\n        elif status in (401, 403):\n            rotate_credentials()\n    raise","preventionTips":["Keep API keys and HMAC secrets valid and rotate them before expiry","Synchronize server clocks (NTP) for date-signed HMAC requests","Compare generated request URL/body against provider docs when debugging 400/404"],"tags":["http","api","error-response"],"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"}