{"record":{"id":"ca236a71853c25fb","repo":"iflytek/astron-agent","slug":"code-execution-timeout-error-code-execution-error","errorCode":"CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR","errorMessage":"self._remove_traceback_stdin_line(stderr)","messagePattern":"self\\._remove_traceback_stdin_line\\(stderr\\)","errorType":"error_code","errorClass":"CustomExceptionCD","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/code/executor/ifly/ifly_executor.py","lineNumber":141,"sourceCode":"        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        stderr = resp_json.get(\"data\", {}).get(\"stderr\", \"\")\n        resp_message = resp_json.get(\"message\", \"\")\n        span.add_error_event(f\"stderr: {stderr}\")\n        span.add_error_event(f\"response message: {resp_message}\")\n\n        err_code = (\n            CodeEnum.CODE_EXECUTION_TIMEOUT_ERROR.code\n            if resp_message.startswith(\n                \"exec code error::context deadline exceeded::signal: killed\"\n            )\n            else CodeEnum.CODE_EXECUTION_ERROR.code\n        )\n        raise CustomExceptionCD(\n            err_code=err_code,\n            err_msg=self._remove_traceback_stdin_line(stderr),\n        )\n\n    async def _do_request(\n        self,\n        url: str,\n        body: dict,\n        params: dict,\n        headers: dict,\n        span: Span,\n    ) -> tuple[int, dict]:\n        \"\"\"\n        Make HTTP request to IFly code execution service.\n\n        :param url: Service endpoint URL\n        :param body: Request body containing code and timeout\n        :param params: Query parameters (app_id, uid)","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/code/executor/ifly/ifly_executor.py#L123-L159","documentation":"_handle_error_response classifies a 500 response from the IFly runner: if the response 'message' starts with 'exec code error::context deadline exceeded::signal: killed', it raises CODE_EXECUTION_TIMEOUT_ERROR, otherwise CODE_EXECUTION_ERROR. The message is the remote stderr with the 'File \"<stdin>\", line N, in <module>' traceback line stripped. This is the user-code failure/signal path for the IFly executor.","triggerScenarios":"The service returned HTTP 500 whose code is NOT pod-not-ready; the response message indicates the remote python process was killed after exceeding the deadline (timeout path) or the code crashed for another reason (generic path).","commonSituations":"User code contains an unhandled exception or infinite loop exceeding timeout_sec; heavy computation killed by the runner; missing dependency causing ImportError on the remote side; memory kill signaled as 'killed'.","solutions":["Read the cleaned stderr in the error message and fix the bug in the submitted Python code.","If it is the timeout variant, increase the timeout passed to execute() or optimize the code.","Ensure required packages are available in the remote runner environment.","Check span error events (stderr, response message) for the full remote traceback."],"exampleFix":"// before (submitted code)\nwhile True: pass  # killed by deadline\n// after\nimport itertools\nfor i in itertools.count():\n    if i >= 1_000_000:\n        break  # bounded loop, finishes within timeout","handlingStrategy":"try-catch","validationCode":"import ast\nast.parse(user_code)  # reject syntax errors before remote submission","typeGuard":null,"tryCatchPattern":"try:\n    result = await executor.execute(...)\nexcept CustomExceptionCD as e:\n    if \"context deadline exceeded\" in str(e):\n        # timeout path: raise timeout, suggest increasing timeout_sec\n        handle_timeout(e)\n    else:\n        handle_code_bug(e)  # surface cleaned stderr to user","preventionTips":["Set timeout_sec generously for long-running code.","Syntax-check and lint user code before remote execution.","Ensure remote runner has required packages pre-installed."],"tags":["remote-execution","timeout","python","stderr"],"backgroundTag":"command-exited-nonzero","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"}