{"record":{"id":"a7c72b960ae0c65b","repo":"iflytek/astron-agent","slug":"code-exec-memory-limit-mb-must-be-between-min-code-exec","errorCode":null,"errorMessage":"CODE_EXEC_MEMORY_LIMIT_MB must be between {MIN_CODE_EXEC_MEMORY_LIMIT_MB} and {MAX_CODE_EXEC_MEMORY_LIMIT_MB} MB","messagePattern":"CODE_EXEC_MEMORY_LIMIT_MB must be between (.+?) and (.+?) MB","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/workflow/configs/app_config.py","lineNumber":304,"sourceCode":"    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\")\n    def validator_url(self) -> \"CodeExecutorConfig\":\n        \"\"\"\n        Validate the URL.\n\n        :return: The validated URL\n        \"\"\"\n        if self.exec_type in [\"ifly\", \"ifly-v2\"]:\n            if not self.url:\n                raise ValueError(\"URL is required for ifly or ifly-v2\")\n            if bool(self.api_key) != bool(self.api_secret):\n                raise ValueError(","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/configs/app_config.py#L286-L322","documentation":"Pydantic field validator rejects a CODE_EXEC_MEMORY_LIMIT_MB outside [MIN_CODE_EXEC_MEMORY_LIMIT_MB, MAX_CODE_EXEC_MEMORY_LIMIT_MB]. This bounds the Pyodide V8 heap limit for sandboxed code execution and fires at settings-load validation time, aborting startup with the invalid value.","triggerScenarios":"Setting CODE_EXEC_MEMORY_LIMIT_MB env var (or the memory_limit_mb field) below the minimum or above the maximum: 0, negative numbers, or extremely large values attempting to disable the heap cap.","commonSituations":"Operators raising the memory limit for heavy user code and exceeding the hard ceiling; unit confusion (bytes/GB vs MB); empty env var parsed as 0 in container deployments.","solutions":["Set CODE_EXEC_MEMORY_LIMIT_MB to an integer inside the supported range (see MIN_/MAX_CODE_EXEC_MEMORY_LIMIT_MB in the config module)","If a larger heap is genuinely required, adjust MAX_CODE_EXEC_MEMORY_LIMIT_MB in code after capacity planning, not via env","Fix unit conversions (e.g. 2GB -> 2048)","Remove the variable to fall back to the default instead of forcing 0"],"exampleFix":"// before\nCODE_EXEC_MEMORY_LIMIT_MB=10240\n// after\nCODE_EXEC_MEMORY_LIMIT_MB=1024","handlingStrategy":"validation","validationCode":"MIN_M, MAX_M = 64, 8192  # mirror config module values\nv = int(os.getenv(\"CODE_EXEC_MEMORY_LIMIT_MB\", \"512\"))\nif not MIN_M <= v <= MAX_M:\n    raise ValueError(f\"CODE_EXEC_MEMORY_LIMIT_MB must be between {MIN_M} and {MAX_M} MB\")","typeGuard":null,"tryCatchPattern":"try:\n    AppConfig()\nexcept ValidationError as e:\n    logger.error(\"invalid CODE_EXEC_MEMORY_LIMIT_MB: %s\", e)\n    sys.exit(2)","preventionTips":["Document MB units in variable naming/comments","Do not attempt to disable the heap cap via extreme values","Check container memory limits are consistent with this value"],"tags":["config","validation","pydantic","memory"],"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"}