{"record":{"id":"80f6f112c8e1753a","repo":"iflytek/astron-agent","slug":"9021-ifly-audit-api","errorCode":"9021","errorMessage":"审核服务异常","messagePattern":"审核服务异常","errorType":"error_code","errorClass":"AuditServiceException","httpStatus":null,"severity":"error","filePath":"core/common/audit_system/audit_api/iflytek/ifly_audit_api.py","lineNumber":156,"sourceCode":"            while True:\n                async with aiohttp.ClientSession(timeout=timeout) as session:\n                    try:\n                        url = self._gen_req_url(f\"{host}{path}\", chat_app_id, uid)\n                        span.add_info_event(\n                            f\"请求URL: {url}, 重试次数: {current_retry}/{RETRY_COUNT}\"\n                        )\n                        async with session.post(url, json=payload) as response:\n                            cause_error = (\n                                f\"状态码: {response.status}, \"\n                                f\"响应内容: {await response.text()}\"\n                            )\n\n                            if response.status != 200:\n                                span.add_error_event(cause_error)\n                                if current_retry < RETRY_COUNT:\n                                    continue\n                                else:\n                                    raise AuditServiceException(*c9021)(cause_error)\n\n                            resp_json = await response.json()\n                            span.add_info_event(f\"送审响应体: {resp_json}\")\n\n                            code = resp_json.get(\"code\", -1)\n                            if int(code) == 0:\n                                return resp_json\n                            if int(code) == 999999 and current_retry < RETRY_COUNT:\n                                continue\n                            else:\n                                cause_error = (\n                                    f\"请求失败，状态码: {response.status}, \"\n                                    f\"响应内容: {await response.text()}, \"\n                                    f\"响应体： {resp_json}\"\n                                )\n                                raise AuditServiceException(*c9021)(cause_error)\n\n                    except (aiohttp.ClientError, asyncio.TimeoutError, Exception) as e:","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/common/audit_system/audit_api/iflytek/ifly_audit_api.py#L138-L174","documentation":"ifly_audit_api._post raises '审核服务异常' when the audit (content-moderation) HTTP call fails after retries — non-2xx status or transport error while POSTing to the moderation host. Called from input_text/output_text, so chat content could not be audited.","triggerScenarios":"`_post` receives `response.status != 200` on every retry attempt while calling the audit HTTP endpoint (from `input_text`/`output_text`).","commonSituations":"Audit gateway down or returning 5xx; wrong AUDIT_API URL/host config; gateway auth rejection returning 401/403; proxy or LB errors between services.","solutions":["Check audit service availability and logs for the failing status code.","Verify audit endpoint URL, app_id/uid credentials, and network access from core/common consumers.","Increase RETRY_COUNT or add backoff if failures are transient.","Confirm no firewall/proxy is blocking the audit host."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    await audit_api.input_text(stage, content, pindex=pindex, span=span, ...)\nexcept AuditServiceException as e:\n    span.record_exception(e)\n    logger.error(\"audit gateway returned non-200; failing open/closed per policy\")","preventionTips":["Health-check the audit endpoint before enabling audit for a deployment.","Keep RETRY_COUNT plus exponential backoff for 5xx responses.","Monitor audit HTTP status metrics and alert on non-200 spikes.","Pin and verify the audit gateway URL in config management."],"tags":["network","audit","http","retry"],"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"}