{"record":{"id":"c42e47ee923e8713","repo":"iflytek/astron-agent","slug":"code-exec-timeout-sec-must-be-between-min-code-exec-timeout","errorCode":null,"errorMessage":"CODE_EXEC_TIMEOUT_SEC must be between {MIN_CODE_EXEC_TIMEOUT_SEC} and {MAX_CODE_EXEC_TIMEOUT_SEC} seconds","messagePattern":"CODE_EXEC_TIMEOUT_SEC must be between (.+?) and (.+?) seconds","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/workflow/configs/app_config.py","lineNumber":293,"sourceCode":"\n    exec_type: str = Field(default=DEFAULT_CODE_EXECUTOR_TYPE, alias=\"CODE_EXEC_TYPE\")\n    url: str = Field(default=\"\", alias=\"CODE_EXEC_URL\")\n    timeout: int = Field(\n        default=DEFAULT_CODE_EXEC_TIMEOUT_SEC, alias=\"CODE_EXEC_TIMEOUT_SEC\"\n    )\n    memory_limit_mb: int = Field(\n        default=DEFAULT_CODE_EXEC_MEMORY_LIMIT_MB,\n        alias=\"CODE_EXEC_MEMORY_LIMIT_MB\",\n    )\n    api_key: str = Field(default=\"\", alias=\"CODE_EXEC_API_KEY\")\n    api_secret: str = Field(default=\"\", alias=\"CODE_EXEC_API_SECRET\")\n\n    @field_validator(\"timeout\")\n    @classmethod\n    def validate_timeout(cls, v: int) -> int:\n        \"\"\"Keep code execution timeouts within the supported safe range.\"\"\"\n        if not MIN_CODE_EXEC_TIMEOUT_SEC <= v <= MAX_CODE_EXEC_TIMEOUT_SEC:\n            raise ValueError(\n                \"CODE_EXEC_TIMEOUT_SEC must be between \"\n                f\"{MIN_CODE_EXEC_TIMEOUT_SEC} and {MAX_CODE_EXEC_TIMEOUT_SEC} seconds\"\n            )\n        return v\n\n    @field_validator(\"memory_limit_mb\")\n    @classmethod\n    def validate_memory_limit_mb(cls, v: int) -> int:\n        \"\"\"Keep the Pyodide V8 heap limit within a bounded range.\"\"\"\n        if not MIN_CODE_EXEC_MEMORY_LIMIT_MB <= v <= MAX_CODE_EXEC_MEMORY_LIMIT_MB:\n            raise ValueError(\n                \"CODE_EXEC_MEMORY_LIMIT_MB must be between \"\n                f\"{MIN_CODE_EXEC_MEMORY_LIMIT_MB} and \"\n                f\"{MAX_CODE_EXEC_MEMORY_LIMIT_MB} MB\"\n            )\n        return v\n\n    @model_validator(mode=\"after\")","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/configs/app_config.py#L275-L311","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nCODE_EXEC_TIMEOUT_SEC=60000\n// after\nCODE_EXEC_TIMEOUT_SEC=60","handlingStrategy":"validation","validationCode":"MIN_T, MAX_T = 1, 300  # mirror config module values\nv = int(os.getenv(\"CODE_EXEC_TIMEOUT_SEC\", \"60\"))\nif not MIN_T <= v <= MAX_T:\n    raise ValueError(f\"CODE_EXEC_TIMEOUT_SEC must be between {MIN_T} and {MAX_T} seconds\")","typeGuard":null,"tryCatchPattern":"try:\n    AppConfig()\nexcept ValidationError as e:\n    logger.error(\"invalid CODE_EXEC_TIMEOUT_SEC: %s\", e)\n    sys.exit(2)","preventionTips":["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)"],"tags":["config","validation","pydantic","workflow"],"backgroundTag":"value-out-of-range","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"}