iflytek/astron-agent · error · CustomExceptionCD
CODE_REQUEST_ERROR
CODE_REQUEST_ERROR
Error message
json.dumps(resp_json, ensure_ascii=False)
What it means
IFlyExecutor._execute_with_retry raises CustomExceptionCD(CODE_REQUEST_ERROR) with the full JSON response body when the remote IFly code-execution service answers with an unexpected status (not 200, not a handled 500 pod-not-ready, not 503). It means the remote runner returned an error the executor does not specifically classify, and the raw response is surfaced for diagnosis.
Solutions
- Read the JSON body in the error message — it contains the server's code/message explaining the rejection.
- Verify workflow_config.code_executor_config.url, api_key and api_secret are correct and the credential is not expired.
- If the server introduced a new error code, add handling for it in _execute_with_retry/_handle_error_response.
- Retry later if the response indicates rate limiting or capacity issues; escalate to the IFly service owners otherwise.
Example fix
null
Defensive patterns
Strategy: try-catch
Validate before calling
cfg = workflow_config.code_executor_config
if not (cfg.url and cfg.api_key and cfg.api_secret):
raise ValueError("IFly code executor URL/credentials not configured") Try / catch
try:
result = await executor.execute(...)
except CustomExceptionCD as e:
body = json.loads(str(e)) if str(e).startswith("{") else None
# inspect body['code']/body['message'] for server-side reason Prevention
- Keep runner URL and Bearer credentials in config validation at startup.
- Monitor for new unclassified error codes and extend _handle_error_response.
- Alert on 401/404 rates to catch credential/URL drift early.
When it happens
Trigger: The service responds with a status other than 200/500/503 (e.g. 400, 401, 404, 429) after _do_request returns; or a 500 whose body 'code' is not the POD_NOT_READY code, so _handle_error_response raises first only for classified messages — unclassified 500 bodies fall through to this raise.
Common situations: Expired/missing Authorization Bearer (api_key:api_secret) yielding 401; wrong workflow_config.code_executor_config.url path yielding 404; request rejected 400 due to malformed code/params; server returns a new unclassified 500 error code.
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
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/7ed27d8c70f4e2e8.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/nodes/code/executor/ifly/ifly_executor.py:110
if status == httpx.codes.OK:
await span.add_info_events_async(
{"code execute result": json.dumps(resp_json, ensure_ascii=False)}
)
runner_result = resp_json.get("data", {}).get("stdout", "")
if isinstance(runner_result, str) and runner_result.endswith("\n"):
runner_result = runner_result[:-1]
return runner_result
if status == httpx.codes.INTERNAL_SERVER_ERROR:
resp_code = resp_json.get("code", 0)
# Pod is not ready yet, retry after delay
if resp_code == ThirdApiCodeEnum.CODE_EXECUTE_POD_NOT_READY_ERROR.code:
await asyncio.sleep(1)
continue
self._handle_error_response(resp_json, span)
raise CustomExceptionCD(
err_code=CodeEnum.CODE_REQUEST_ERROR.code,
err_msg=json.dumps(resp_json, ensure_ascii=False),
)
raise CustomException(
err_code=CodeEnum.CODE_REQUEST_ERROR,
err_msg="Retry attempts exceeded 5 times",
cause_error="Retry attempts exceeded 5 times",
)
def _handle_error_response(self, resp_json: dict, span: Span) -> None:
"""
Handle error response and raise appropriate exception.
:param resp_json: Response json dictionary
:param span: Tracing span for logging
:raises CustomExceptionCD: Based on error type
"""View on GitHub (pinned to 5e758547a8)