iflytek/astron-agent · error · ValueError
CODE_EXEC_TIMEOUT_SEC must be between
Error message
CODE_EXEC_TIMEOUT_SEC must be between {MIN_CODE_EXEC_TIMEOUT_SEC} and {MAX_CODE_EXEC_TIMEOUT_SEC} seconds What it means
Pydantic field validator on the code-execution config rejects a CODE_EXEC_TIMEOUT_SEC value outside the supported safe range [MIN_CODE_EXEC_TIMEOUT_SEC, MAX_CODE_EXEC_TIMEOUT_SEC]. Thrown at settings load time (validation), so the service refuses to start with an out-of-range timeout. It exists to keep sandboxed code execution bounded.
Solutions
- Set CODE_EXEC_TIMEOUT_SEC to an integer within the supported range (check MIN_/MAX_CODE_EXEC_TIMEOUT_SEC in the same config module)
- If you need longer execution, raise MAX_CODE_EXEC_TIMEOUT_SEC deliberately in code after assessing sandbox risk, not via env var
- Correct ms-vs-s unit mistakes (e.g. 60000 -> 60)
- Ensure the env var is unset rather than empty/0 when you want the default
Example fix
// before CODE_EXEC_TIMEOUT_SEC=60000 // after CODE_EXEC_TIMEOUT_SEC=60
Defensive patterns
Strategy: validation
Validate before calling
MIN_T, MAX_T = 1, 300 # mirror config module values
v = int(os.getenv("CODE_EXEC_TIMEOUT_SEC", "60"))
if not MIN_T <= v <= MAX_T:
raise ValueError(f"CODE_EXEC_TIMEOUT_SEC must be between {MIN_T} and {MAX_T} seconds") Try / catch
try:
AppConfig()
except ValidationError as e:
logger.error("invalid CODE_EXEC_TIMEOUT_SEC: %s", e)
sys.exit(2) Prevention
- Validate env values in CI/deploy pipelines before shipping
- Use the default (unset the var) unless tuning is intentional
- Keep units documented next to the variable name (seconds)
When it happens
Trigger: Setting CODE_EXEC_TIMEOUT_SEC env var (or the timeout field of the config model) to a value below the minimum or above the maximum; typos like 0, negative values, or unit mistakes (e.g. 60000 meaning ms instead of seconds).
Common situations: Deployers copying timeout values from other services that use milliseconds; tuning execution limits for slow sandboxes and exceeding the max; template/env files with placeholder or empty values parsed as 0.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- CODE_EXEC_MEMORY_LIMIT_MB must be between
- mcpServerId and mcpServerUrl cannot both be empty
- toolName cannot be empty
- S3_PRESIGN_ERROR
- WORKFLOW_VERSION_PUBLISH_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/c42e47ee923e8713.
Report an issue: GitHub.
Appendix: source
Thrown at core/workflow/configs/app_config.py:293
exec_type: str = Field(default=DEFAULT_CODE_EXECUTOR_TYPE, alias="CODE_EXEC_TYPE")
url: str = Field(default="", alias="CODE_EXEC_URL")
timeout: int = Field(
default=DEFAULT_CODE_EXEC_TIMEOUT_SEC, alias="CODE_EXEC_TIMEOUT_SEC"
)
memory_limit_mb: int = Field(
default=DEFAULT_CODE_EXEC_MEMORY_LIMIT_MB,
alias="CODE_EXEC_MEMORY_LIMIT_MB",
)
api_key: str = Field(default="", alias="CODE_EXEC_API_KEY")
api_secret: str = Field(default="", alias="CODE_EXEC_API_SECRET")
@field_validator("timeout")
@classmethod
def validate_timeout(cls, v: int) -> int:
"""Keep code execution timeouts within the supported safe range."""
if not MIN_CODE_EXEC_TIMEOUT_SEC <= v <= MAX_CODE_EXEC_TIMEOUT_SEC:
raise ValueError(
"CODE_EXEC_TIMEOUT_SEC must be between "
f"{MIN_CODE_EXEC_TIMEOUT_SEC} and {MAX_CODE_EXEC_TIMEOUT_SEC} seconds"
)
return v
@field_validator("memory_limit_mb")
@classmethod
def validate_memory_limit_mb(cls, v: int) -> int:
"""Keep the Pyodide V8 heap limit within a bounded range."""
if not MIN_CODE_EXEC_MEMORY_LIMIT_MB <= v <= MAX_CODE_EXEC_MEMORY_LIMIT_MB:
raise ValueError(
"CODE_EXEC_MEMORY_LIMIT_MB must be between "
f"{MIN_CODE_EXEC_MEMORY_LIMIT_MB} and "
f"{MAX_CODE_EXEC_MEMORY_LIMIT_MB} MB"
)
return v
@model_validator(mode="after")View on GitHub (pinned to 5e758547a8)