iflytek/astron-agent · error · CustomExceptionCD

CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR

CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR

Error message

self._remove_traceback_stdin_line(stderr)

What it means

_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.

Solutions

  1. Read the cleaned stderr in the error message and fix the bug in the submitted Python code.
  2. If it is the timeout variant, increase the timeout passed to execute() or optimize the code.
  3. Ensure required packages are available in the remote runner environment.
  4. Check span error events (stderr, response message) for the full remote traceback.

Example fix

// before (submitted code)
while True: pass  # killed by deadline
// after
import itertools
for i in itertools.count():
    if i >= 1_000_000:
        break  # bounded loop, finishes within timeout
Defensive patterns

Strategy: try-catch

Validate before calling

import ast
ast.parse(user_code)  # reject syntax errors before remote submission

Try / catch

try:
    result = await executor.execute(...)
except CustomExceptionCD as e:
    if "context deadline exceeded" in str(e):
        # timeout path: raise timeout, suggest increasing timeout_sec
        handle_timeout(e)
    else:
        handle_code_bug(e)  # surface cleaned stderr to user

Prevention

When it happens

Trigger: 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).

Common situations: 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'.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/ca236a71853c25fb. Report an issue: GitHub.

Appendix: source

Thrown at core/workflow/engine/nodes/code/executor/ifly/ifly_executor.py:141

        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
        """
        stderr = resp_json.get("data", {}).get("stderr", "")
        resp_message = resp_json.get("message", "")
        span.add_error_event(f"stderr: {stderr}")
        span.add_error_event(f"response message: {resp_message}")

        err_code = (
            CodeEnum.CODE_EXECUTION_TIMEOUT_ERROR.code
            if resp_message.startswith(
                "exec code error::context deadline exceeded::signal: killed"
            )
            else CodeEnum.CODE_EXECUTION_ERROR.code
        )
        raise CustomExceptionCD(
            err_code=err_code,
            err_msg=self._remove_traceback_stdin_line(stderr),
        )

    async def _do_request(
        self,
        url: str,
        body: dict,
        params: dict,
        headers: dict,
        span: Span,
    ) -> tuple[int, dict]:
        """
        Make HTTP request to IFly code execution service.

        :param url: Service endpoint URL
        :param body: Request body containing code and timeout
        :param params: Query parameters (app_id, uid)

View on GitHub (pinned to 5e758547a8)