{"record":{"id":"ea29d4d045eec112","repo":"iflytek/astron-agent","slug":"code-request-error-retry-attempts-exceeded-5-times","errorCode":"CODE_REQUEST_ERROR","errorMessage":"Retry attempts exceeded 5 times","messagePattern":"Retry attempts exceeded 5 times","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/code/executor/ifly/ifly_executor_v2.py","lineNumber":117,"sourceCode":"                            resp_json, ensure_ascii=False\n                        )\n                    }\n                )\n                runner_result = (\n                    resp_json.get(\"data\", {}).get(\"code_resp\", {}).get(\"stdout\", \"\")\n                )\n                if isinstance(runner_result, str) and runner_result.endswith(\"\\n\"):\n                    runner_result = runner_result[:-1]\n                return runner_result\n\n            resp_code = resp_json.get(\"code\", 0)\n            if resp_code in RETRYABLE_ERROR_CODES:\n                await asyncio.sleep(1)\n                continue\n\n            self._handle_error_response(resp_json, span)\n\n        raise CustomException(\n            err_code=CodeEnum.CODE_REQUEST_ERROR,\n            err_msg=\"Retry attempts exceeded 5 times\",\n            cause_error=\"Retry attempts exceeded 5 times\",\n        )\n\n    def _handle_error_response(self, resp_json: dict, span: Span) -> None:\n        \"\"\"\n        Handle error response and raise appropriate exception.\n\n        :param resp_json: Response json dictionary\n        :param span: Tracing span for logging\n        :raises CustomExceptionCD: Based on error type\n        \"\"\"\n\n        err_type = resp_json.get(\"type\", \"\")\n        resp_message = resp_json.get(\"message\", \"\")\n        span.add_error_event(f\"err_type: {err_type}\")\n        span.add_error_event(f\"response message: {resp_message}\")","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/code/executor/ifly/ifly_executor_v2.py#L99-L135","documentation":"In ifly_executor_v2._execute_with_retry, when the remote code-execution service keeps returning retryable error codes, the loop sleeps 1s and retries; after the retry budget is exhausted (message says 5 times) it raises CODE_REQUEST_ERROR with a fixed 'Retry attempts exceeded 5 times' message. It means the code service never produced a successful (or definitively non-retryable-failed) response within the retry window.","triggerScenarios":"Calling execute() on a code node backed by the v2 iFly executor where each HTTP response carries a retryable error code (per RETRYABLE_ERROR_CODES), causing `continue` on every iteration until the loop falls through to the final raise.","commonSituations":"The remote code service is overloaded or rate-limiting; the sandbox queue is backed up under concurrent workflow runs; intermittent 5xx/429 responses for the whole retry window; misconfigured endpoint hitting a busy shared instance.","solutions":["Inspect the code service logs for the 5 retryable responses to find the underlying code (rate limit, overload, 5xx).","Reduce concurrency or add backoff/capacity to the code-executor service; scale the sandbox workers.","Increase the retry count or sleep interval if the service recovers under short load spikes (edit _execute_with_retry constants).","Verify endpoint configuration points at the correct, healthy service instance."],"exampleFix":"# before\nif resp_code in RETRYABLE_ERROR_CODES:\n    await asyncio.sleep(1)\n    continue\n// after: exponential backoff with jitter\nif resp_code in RETRYABLE_ERROR_CODES:\n    await asyncio.sleep(min(2 ** attempt, 30) + random.random())\n    continue","handlingStrategy":"retry","validationCode":"# pre-check service load before dispatching\nresp = await http.get(f\"{code_service_url}/health\")\nif resp.status_code != 200:\n    raise RuntimeError(\"code executor unhealthy, abort before retry loop\")","typeGuard":null,"tryCatchPattern":"try:\n    output = await executor.execute(...)\nexcept CustomException as e:\n    if \"Retry attempts exceeded\" in str(e.err_msg):\n        await asyncio.sleep(backoff)\n        output = await executor.execute(...)  # one outer-level retry","preventionTips":["Use exponential backoff with jitter instead of fixed 1s sleeps","Monitor code-service saturation and scale workers before retries exhaust","Cap workflow concurrency during peak load"],"tags":["retry","timeout","http-request","workflow"],"backgroundTag":"retry-attempts-exhausted","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"}