{"record":{"id":"99946c3b597ab4a3","repo":"iflytek/astron-agent","slug":"cbg-ragerror","errorCode":"CBG_RAGError","errorMessage":"CBG Network error: {e}","messagePattern":"CBG Network error: (.+?)","errorType":"error_code","errorClass":"ThirdPartyException","httpStatus":null,"severity":"critical","filePath":"core/knowledge/infra/xinghuo/xinghuo.py","lineNumber":445,"sourceCode":"                        timeout=aiohttp.ClientTimeout(\n                            total=float(os.getenv(\"XINGHUO_CLIENT_TIMEOUT\", \"60.0\"))\n                        ),\n                    ) as response:\n                        background_json = await response.text()\n                        span_context.add_info_events({\"RAG_OUTPUT\": background_json})\n                        msg_js = json.loads(background_json)\n\n                        if msg_js[\"code\"] == 0 and msg_js[\"flag\"]:\n                            return msg_js[\"data\"]\n                        logger.error(\n                            url + \"Failed to 【XINGHUO-RAG】,err reason %s\",\n                            msg_js[\"desc\"],\n                        )\n                        raise ThirdPartyException(msg_js[\"desc\"])\n            except aiohttp.ClientError as e:\n                logger.error(f\"Network error: {e}\")\n                span_context.record_exception(e)\n                raise ThirdPartyException(\n                    e=CodeEnum.CBG_RAGError, msg=f\"CBG Network error: {e}\"\n                ) from e\n            except asyncio.TimeoutError as e:\n                logger.error(f\"Request timeout: {url}\")\n                span_context.record_exception(e)\n                raise ThirdPartyException(\n                    e=CodeEnum.CBG_RAGError, msg=f\"CBG Request timeout: {url}\"\n                ) from e\n    else:\n        # Fallback without span\n        headers = await assemble_spark_auth_headers_async()\n        headers[\"Content-Type\"] = \"application/json\"\n\n        try:\n            async with aiohttp.ClientSession() as session:\n                async with session.request(\n                    method=method,\n                    url=url,","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/xinghuo/xinghuo.py#L427-L463","documentation":"In the traced branch of async_request(), aiohttp.ClientError (connection failures, DNS errors, TLS problems, aborted connections) is caught, logged, recorded on the tracing span, and re-raised as ThirdPartyException with code CBG_RAGError and message 'CBG Network error: ...'. It means the HTTP request to the Xinghuo RAG service failed at the transport level.","triggerScenarios":"Any async_request-based call (split, get_chunks, new_topk_search, dataset_addchunk, dataset_updchunk) where the TCP connection cannot be established or breaks: host unreachable, DNS failure, TLS handshake error, proxy rejection, connection reset mid-response.","commonSituations":"XINGHUO_RAG_URL pointing at a wrong host/port; cluster egress firewall blocking the RAG endpoint; VPN or proxy not configured; DNS misconfiguration in containers; Xinghuo service temporarily down.","solutions":["Test connectivity from the runtime host: curl -v <XINGHUO_RAG_URL> — fix DNS/proxy/firewall accordingly.","Verify XINGHUO_RAG_URL scheme/host/port are correct (https vs http, correct region).","If behind a corporate proxy, set HTTP(S)_PROXY env vars or configure aiohttp trust_env.","Retry the operation; add callers' own backoff around split/get_chunks for transient network faults."],"exampleFix":"# before\nresp = await async_request(body, os.getenv(\"XINGHUO_RAG_URL\", \"\") + \"openapi/v1/file/split\")\n# after\nbase = os.getenv(\"XINGHUO_RAG_URL\")\nif not base:\n    raise RuntimeError(\"XINGHUO_RAG_URL not set\")\ntry:\n    resp = await async_request(body, base + \"openapi/v1/file/split\")\nexcept ThirdPartyException:\n    logger.exception(\"Xinghuo RAG unreachable at %s\", base)\n    raise","handlingStrategy":"retry","validationCode":"import socket\nsocket.gethostbyname(host_from_url)  # fail fast on DNS problems\n# or: curl -sf <XINGHUO_RAG_URL>/health from the deploy script","typeGuard":"def is_network_error(exc: BaseException) -> bool:\n    return isinstance(exc, ThirdPartyException) and \"CBG Network error\" in str(exc)","tryCatchPattern":"for attempt in range(3):\n    try:\n        return await split(document)\n    except ThirdPartyException as e:\n        if \"CBG Network error\" not in str(e) or attempt == 2:\n            raise\n        await asyncio.sleep(2 ** attempt)","preventionTips":["Health-check XINGHUO_RAG_URL at startup and before batch jobs.","Configure proxy/egress rules so the runtime can reach the Xinghuo host.","Use exponential backoff retries for transport-level faults."],"tags":["network","aiohttp","http","third-party","connectivity"],"backgroundTag":"network-request-failed","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"}