iflytek/astron-agent · error · CustomException
CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR
CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR
Error message
error_message[:MAX_ERROR_MESSAGE_LENGTH]
What it means
In langchain_executor.execute, when the sandboxed subprocess result reports a non-success status, the executor raises CODE_EXECUTION_TIMEOUT_ERROR if the stderr matches the timeout heuristic (_is_timeout_error) or CODE_EXECUTION_ERROR otherwise. The message is the process stderr (or 'Code execution failed'), truncated to MAX_ERROR_MESSAGE_LENGTH. It represents the local/isolated sandbox refusing or failing the run.
Solutions
- Read the truncated stderr message in the error to find the exact exception or timeout indicator.
- Fix the code-node script (imports, null checks, logic) if it's an execution error.
- Reduce workload or increase timeout/memory bounds if the error is a timeout/OOM kill.
- Add explicit error handling and prints in user code to fail fast with clear messages instead of deep tracebacks.
Example fix
// before code = "for i in range(len(data)): process(data[i]) # may exceed timeout" // after code = "\nimport signal\n# chunk the work and guard inputs\nassert data, 'empty input'\nfor row in data[:MAX_ROWS]:\n process(row)"
Defensive patterns
Strategy: validation
Validate before calling
# pre-flight compile check of user code before sandbox execution
try:
compile(user_code, "<code_node>", "exec")
except SyntaxError as e:
raise ValueError(f"code node syntax error before execution: {e}") Type guard
def looks_like_timeout(stderr: str) -> bool:
s = (stderr or "").lower()
return "timeout" in s or "timed out" in s or "killed" in s Try / catch
try:
output = await executor.execute(language, code, timeout, span)
except CustomException as e:
if e.err_code in (CodeEnum.CODE_EXECUTION_TIMEOUT_ERROR, CodeEnum.CODE_EXECUTION_ERROR):
logger.error("sandbox failure: %s", e.err_msg)
output = "" Prevention
- Validate/compile code-node scripts at design time
- Keep workloads within the sandbox timeout and memory bounds
- Print clear error messages in user code so stderr stays readable after truncation
When it happens
Trigger: Calling execute() with code that exits nonzero: raises an uncaught Python/JS exception (stderr contains traceback), exceeds bounded_timeout so the runner kills it (timeout error string), violates memory_limit_mb, or the runner itself crashes and writes errors to stderr.
Common situations: Timeouts from infinite loops or oversized workloads; unhandled exceptions from wrong assumptions about input variables; memory-limit kills on large dataframes; stderr noise from warnings combined with a real error overflowing truncation.
Related errors
- CODE_EXECUTION_ERROR
- 21600
- CODE_EXECUTION_TIMEOUT_ERROR|CODE_EXECUTION_ERROR
- CODE_EXECUTION_TIMEOUT_ERROR
- Timed out acquiring distributed lock, please try again later
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/7809686067408e5c.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/engine/nodes/code/executor/langchain/langchain_executor.py:109
source_file.write(code)
sandbox = _FilePyodideSandbox(
source_path,
allow_env=False,
allow_read=["node_modules", source_path],
allow_write=False,
allow_net=False,
allow_run=False,
allow_ffi=False,
)
result = await sandbox.execute(
code,
timeout_seconds=bounded_timeout,
memory_limit_mb=bounded_memory_limit,
)
if result.status == "success":
return result.stdout if result.stdout else ""
error_message = (result.stderr or "Code execution failed").strip()
raise CustomException(
err_code=(
CodeEnum.CODE_EXECUTION_TIMEOUT_ERROR
if _is_timeout_error(error_message)
else CodeEnum.CODE_EXECUTION_ERROR
),
err_msg=error_message[:MAX_ERROR_MESSAGE_LENGTH],
)
except CustomException as e:
raise e
except Exception as e:
raise CustomException(
err_code=CodeEnum.CODE_EXECUTION_ERROR,
cause_error=e,
) from e
View on GitHub (pinned to 5e758547a8)