{"record":{"id":"d92594175937804d","repo":"infiniflow/ragflow","slug":"execution-timeout-must-be-greater-than-0-seconds-d92594","errorCode":null,"errorMessage":"Execution timeout must be greater than 0 seconds, got {requested_timeout}.","messagePattern":"Execution timeout must be greater than 0 seconds, got (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"warning","filePath":"agent/sandbox/providers/ssh.py","lineNumber":189,"sourceCode":"\n        normalized_lang = self._normalize_language(language)\n        instance = self._instances[instance_id]\n        client: paramiko.SSHClient = instance[\"client\"]\n        sftp: paramiko.SFTPClient = instance[\"sftp\"]\n        remote_work_dir: str = instance[\"remote_work_dir\"]\n\n        args_json = json.dumps(arguments or {}, ensure_ascii=False)\n        remote_script_path, command = self._upload_script(\n            sftp=sftp,\n            remote_work_dir=remote_work_dir,\n            language=normalized_lang,\n            code=code,\n            args_json=args_json,\n        )\n\n        requested_timeout = self.timeout if timeout is None else int(timeout)\n        if requested_timeout <= 0:\n            raise RuntimeError(f\"Execution timeout must be greater than 0 seconds, got {requested_timeout}.\")\n        exec_timeout = min(requested_timeout, self.timeout)\n\n        start_time = time.time()\n        stdout, stderr, exit_code = self._run_remote_command(client, command, timeout=exec_timeout)\n        execution_time = time.time() - start_time\n\n        self._validate_output_size(stdout, stderr)\n        stdout, structured_result = extract_structured_result(stdout)\n\n        return ExecutionResult(\n            stdout=stdout,\n            stderr=stderr,\n            exit_code=exit_code,\n            execution_time=execution_time,\n            metadata={\n                \"instance_id\": instance_id,\n                \"language\": normalized_lang,\n                \"script_path\": remote_script_path,","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/sandbox/providers/ssh.py#L171-L207","documentation":"Raised by SSHProvider.execute_code when the effective execution timeout resolves to zero or a negative number. The effective value is int(timeout) if the caller passes one, otherwise the provider-level self.timeout (default 30, set from config). It is a pure input-validation guard fired before any SSH traffic, though it raises RuntimeError rather than ValueError.","triggerScenarios":"Calling execute_code(..., timeout=0) or timeout=-5; passing timeout=None while the provider was initialized with config timeout=0 (initialize does not reject non-positive timeouts); passing a numeric string like \"0\" that int() coerces to 0.","commonSituations":"Configuring agent/component timeouts with 0 meaning 'no limit' (this provider treats 0 as invalid, not unlimited); per-call timeout derived from a remaining-deadline computation that hits 0 on retry; copy-pasting defaults from another provider that accepts 0.","solutions":["Pass a positive timeout (e.g. 30) to execute_code, or omit it to use the provider default","If your config sets timeout=0 intending 'no limit', set a large finite value instead — the provider clamps exec_timeout to min(requested, self.timeout) anyway","Clamp computed deadlines: timeout=max(1, int(remaining)) before calling"],"exampleFix":"// before\nresult = provider.execute_code(instance_id, code, \"python\", timeout=0)\n\n// after\nresult = provider.execute_code(instance_id, code, \"python\", timeout=30)","handlingStrategy":"validation","validationCode":"timeout = int(timeout) if timeout is not None else provider.timeout\nif timeout <= 0:\n    timeout = 30\nresult = provider.execute_code(instance_id, code, language, timeout=timeout)","typeGuard":"def is_valid_timeout(t) -> bool:\n    try:\n        return int(t) > 0\n    except (TypeError, ValueError):\n        return False","tryCatchPattern":null,"preventionTips":["Never send timeout=0 intending 'unlimited' — this provider reads it as invalid","Clamp computed deadlines: max(1, int(remaining_seconds))","Set a sane provider-level timeout at initialize; it also caps per-call values"],"tags":["validation","timeout","ssh","sandbox"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}