{"record":{"id":"00a4e47a0e5caa80","repo":"microsoft/autogen","slug":"timeout-must-be-greater-than-or-equal-to-1","errorCode":null,"errorMessage":"Timeout must be greater than or equal to 1.","messagePattern":"Timeout must be greater than or equal to 1\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/code_executors/azure/_azure_container_code_executor.py","lineNumber":109,"sourceCode":"    def __init__(\n        self,\n        pool_management_endpoint: str,\n        credential: TokenProvider,\n        timeout: int = 60,\n        work_dir: Union[Path, str, None] = None,\n        functions: Sequence[\n            Union[\n                FunctionWithRequirements[Any, A],\n                Callable[..., Any],\n                FunctionWithRequirementsStr,\n            ]\n        ] = [],\n        functions_module: str = \"functions\",\n        suppress_result_output: bool = False,\n        session_id: Optional[str] = None,\n    ):\n        if timeout < 1:\n            raise ValueError(\"Timeout must be greater than or equal to 1.\")\n\n        self._work_dir: Optional[Path] = None\n        self._temp_dir: Optional[tempfile.TemporaryDirectory[str]] = None\n\n        # If a user specifies a working directory, use that\n        if work_dir is not None:\n            if isinstance(work_dir, str):\n                self._work_dir = Path(work_dir)\n            else:\n                self._work_dir = work_dir\n            # Create the directory if it doesn't exist\n            self._work_dir.mkdir(exist_ok=True, parents=True)\n        # If a user does not specify a working directory, use the default directory (tempfile.TemporaryDirectory)\n        else:\n            self._temp_dir = tempfile.TemporaryDirectory()\n            temp_dir_path = Path(self._temp_dir.name)\n            temp_dir_path.mkdir(exist_ok=True, parents=True)\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/code_executors/azure/_azure_container_code_executor.py#L91-L127","documentation":"AzureContainerCodeExecutor.__init__ validates its timeout parameter and raises ValueError when timeout < 1. The timeout (seconds) is forwarded to the Azure Container Apps job that actually executes code, and the service rejects sub-second timeouts — so the constructor fails fast instead of surfacing an opaque API error later.","triggerScenarios":"Constructing AzureContainerCodeExecutor(pool_management_client, acr_client, ..., timeout=0) or a fractional timeout like 0.5, often from a config default of 0 or a computed value that ended up zero.","commonSituations":"Config files where timeout defaults to 0 meaning 'unset', arithmetic that computes timeout - safety_margin and goes below 1, copying a LocalCommandLineCodeExecutor config that allowed smaller values.","solutions":["Set timeout to at least 1 second, practically 30-600 s for real workloads","Guard your config loader: timeout = max(1, int(cfg.get('timeout', 60)))","Treat 0 in config as 'use default' and substitute the default instead of passing it through"],"exampleFix":"# before\nexecutor = AzureContainerCodeExecutor(pm_client, acr_client, resource_group, subscription_id, acr_name, timeout=cfg.get('timeout', 0))\n\n# after\nexecutor = AzureContainerCodeExecutor(pm_client, acr_client, resource_group, subscription_id, acr_name, timeout=max(1, cfg.get('timeout', 60)))","handlingStrategy":"validation","validationCode":"def valid_timeout(t) -> int:\n    return max(1, int(t)) if t else 60","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp user config: timeout = max(1, int(config.get('timeout', 60)))","Treat 0 as 'unset' and substitute a sane default (60s+)","Keep executor construction behind one factory that validates all params"],"tags":["azure","code-executor","configuration","validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}