iflytek/astron-agent · error · CustomException
KNOWLEDGE_REQUEST_ERROR
KNOWLEDGE_REQUEST_ERROR
Error message
Knowledge Pro node response status: {response.status} What it means
After posting to the Knowledge Pro API, the node checks the HTTP status; any status other than 200 (httpx.codes.OK) raises a CustomException with KNOWLEDGE_REQUEST_ERROR whose cause includes the status code. It means the Knowledge Pro service rejected or failed the request at the HTTP level.
Solutions
- Check the Knowledge Pro service logs for the failure corresponding to the returned status
- Verify the node's Knowledge Pro API URL and credentials are correct and the service is reachable
- If 401, refresh/fix the auth token; if 5xx, retry after the service recovers or check gateway health
Defensive patterns
Strategy: try-catch
Validate before calling
import httpx
async def knowledge_pro_reachable(url: str, headers: dict) -> bool:
try:
r = await httpx.AsyncClient().get(url, headers=headers, timeout=5)
return r.status_code < 500
except httpx.HTTPError:
return False Try / catch
try:
result = await node.async_execute(variable_pool, span)
except CustomException as e:
if e.err_code == CodeEnum.KNOWLEDGE_REQUEST_ERROR:
log.error("Knowledge Pro HTTP failure: %s", e.cause_error) # contains status
# retry with backoff for 5xx, alert for 4xx Prevention
- Health-check the Knowledge Pro service before workflow runs
- Verify API URL and credentials in node configuration
- Add retry with exponential backoff for 5xx statuses
- Monitor gateway/service uptime
When it happens
Trigger: The async aiohttp/httpx POST to the Knowledge Pro retrieval API returns e.g. 401, 404, 500, or 502 instead of 200; auth token invalid, URL wrong, or the knowledge service crashing.
Common situations: Knowledge Pro service is down or restarting in the cluster; API base URL configured incorrectly in node settings; expired credentials rejected with 401; gateway returning 502/504 under load.
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
- Remote resource returned HTTP
- MCP_REQUEST_ERROR
- sandbox-exec failed: HTTP
- Skill resource download failed: HTTP
- MODEL_CHECK_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/1968077c2dc49f27.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/nodes/knowledge_pro/knowledge_pro_node.py:148
# Get the Knowledge Pro API endpoint URL from environment or use default
url = f"{os.getenv('KNOWLEDGE_PRO_BASE_URL')}/knowledge/v1/agent/achat"
# Validate CBG RAG parameters before proceeding
await self._check_cbg_rag_param()
# Generate request payload for the Knowledge Pro API
payload = self.gen_req_payload(query, span)
await span.add_info_event_async(f"request body: {payload}")
# Create HTTP session with appropriate timeout configuration
async with aiohttp.ClientSession(
timeout=ClientTimeout(
total=30 * 60, sock_connect=30, sock_read=interval_timeout
)
) as session:
# Send POST request to Knowledge Pro API
async with session.post(url=url, json=payload) as response:
if response.status != httpx.codes.OK:
raise CustomException(
err_code=CodeEnum.KNOWLEDGE_REQUEST_ERROR,
cause_error=f"Knowledge Pro node response status: {response.status}",
)
content_list, knowledge_metadata, token_usage = (
await self._handle_response(
response, span, variable_pool, msg_or_end_node_deps
)
)
# Prepare final outputs with combined content and metadata
outputs = {"output": "".join(content_list), "result": knowledge_metadata}
except asyncio.TimeoutError:
# Handle timeout errors during API request
log_err = CustomException(
err_code=CodeEnum.KNOWLEDGE_REQUEST_ERROR,
err_msg=f"Knowledge Pro node response timeout ({interval_timeout}s)",
)View on GitHub (pinned to 5e758547a8)