iflytek/astron-agent · error · ThirdPartyException
Failed to 【XINGHUO-RAG】; code
Error message
Failed to 【XINGHUO-RAG】; code: {resp.status} What it means
Raised by _process_form_response when the XINGHUO-RAG HTTP endpoint returns a non-200 status code. The library wraps the status code into a ThirdPartyException so callers get a uniform error type for upstream RAG failures. It indicates the remote CBG/XINGHUO RAG service rejected the request at the HTTP level.
Solutions
- Verify the XINGHUO base URL and endpoint path in configuration are correct for your environment
- Check XINGHUO app_id/app_secret credentials are valid and not expired
- Log the response body at the failing status to see the upstream error detail (response_text is already captured in RAG_OUTPUT span events)
- Check XINGHUO service health/status page or retry after transient 5xx
- Add retry with backoff for transient 5xx statuses in async_form_request
Defensive patterns
Strategy: try-catch
Validate before calling
import aiohttp
async def endpoint_ok(session: aiohttp.ClientSession, url: str) -> bool:
try:
async with session.get(url.replace('/api', '/health')) as r:
return r.status == 200
except Exception:
return False Type guard
def is_ok(resp: aiohttp.ClientResponse) -> bool:
return resp.status == 200 Try / catch
try:
data = await async_form_request(body, url)
except ThirdPartyException as e:
if 'code:' in str(e):
logger.warning(f"XINGHUO HTTP failure: {e}")
# surface to user / alert ops Prevention
- Validate XINGHUO base URL and credentials at service startup
- Monitor/alert on non-200 responses to the RAG endpoint
- Use health checks before critical RAG calls
- Keep credentials rotation automated to avoid 401s
When it happens
Trigger: Any async_form_request to a XINGHUO-RAG URL (topk search, doc upload, chunk ops) where the aiohttp response status is not 200 — e.g. 401 from expired app_id/app_secret, 404 from wrong base URL, 400 from malformed form fields.
Common situations: Misconfigured XINGHUO base URL or app credentials in environment config; expired or revoked XINGHUO API keys; XINGHUO service outage or gateway returning 5xx; wrong endpoint path after API version change.
Related errors
- Document splitting failed after retries
- {desc from XINGHUO-RAG response}
- CBG_RAGError
- RAGFLOW_RAGError
- sandbox-exec failed: HTTP
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/614c3f2ee32254a1.
Report an issue: GitHub.
Appendix: source
Thrown at core/knowledge/infra/xinghuo/xinghuo.py:553
Args:
resp: HTTP response object
url: Request URL
span_context: Tracking context
Returns:
Dict[str, Any]: Processed response data
Raises:
ThirdPartyException: Raised when response error occurs
"""
response_text = await resp.text()
if span_context:
span_context.add_info_events({"RAG_OUTPUT": response_text})
if resp.status != 200:
logger.error(f"{url} Failed to 【XINGHUO-RAG】; err code {resp.status}")
raise ThirdPartyException(f"Failed to 【XINGHUO-RAG】; code: {resp.status}")
try:
msg_js = await resp.json()
except json.JSONDecodeError:
msg_js = json.loads(response_text)
if msg_js.get("code") == 0 and msg_js.get("flag"):
return msg_js.get("data", {})
error_desc = msg_js.get("desc", "Unknown error from XINGHUO-RAG")
logger.error(f"{url} Failed to 【XINGHUO-RAG】, err reason {error_desc}")
raise ThirdPartyException(e=CodeEnum.CBG_RAGError, msg=error_desc)
def _handle_form_request_error(e: Exception, url: str, span_context: Any) -> None:
"""
Handle form request errors
View on GitHub (pinned to 5e758547a8)