infiniflow/ragflow · error · RuntimeError
Execution timeout must be greater than 0 seconds, got {reque
Error message
Execution timeout must be greater than 0 seconds, got {requested_timeout}. What it means
Raised by the provider's execute path when the resolved execution timeout is zero or negative. `requested_timeout` defaults to the configured `self.timeout` (30) when the caller passes timeout=None; an explicit int(timeout) <= 0 is rejected before any code runs.
Source
Thrown at agent/sandbox/providers/ucloud_agent_sandbox.py:192
arguments: Values passed to the user-defined main function.
Returns:
Captured output, structured result metadata, and allowed artifacts.
"""
if not self._initialized:
raise RuntimeError("Provider not initialized. Call initialize() first.")
if instance_id not in self._instances:
raise RuntimeError(f"Unknown UCloud Agent Sandbox instance: {instance_id}")
normalized_lang = self._normalize_language(language)
instance = self._instances[instance_id]
sandbox = instance["sandbox"]
remote_work_dir: str = instance["remote_work_dir"]
script_path, executable = self._prepare_script(sandbox, remote_work_dir, normalized_lang, code, arguments or {})
requested_timeout = self.timeout if timeout is None else int(timeout)
if requested_timeout <= 0:
raise RuntimeError(f"Execution timeout must be greater than 0 seconds, got {requested_timeout}.")
exec_timeout = min(requested_timeout, self.timeout)
sdk = _get_ucloud_sandbox_module()
start_time = time.time()
try:
sandbox.set_timeout(max(self.sandbox_timeout, exec_timeout + 30), request_timeout=self.timeout)
result = sandbox.commands.run(
f"{executable} {shlex.quote(script_path)}",
cwd=remote_work_dir,
timeout=exec_timeout,
request_timeout=max(self.timeout, exec_timeout),
)
except sdk.CommandExitException as exc:
result = exc
except sdk.TimeoutException as exc:
raise TimeoutError(f"Execution timed out after {exec_timeout} seconds") from exc
except Exception as exc:
raise RuntimeError(f"UCloud Agent Sandbox execution failed: {exc}") from excView on GitHub (pinned to 554fb1133a)
Solutions
- Pass a positive timeout (>=1) or omit it to use the configured default of 30s.
- Clamp computed deadlines: `timeout=max(1, int(remaining))`.
- Fix provider config if `timeout` itself is <= 0.
- Validate before calling execute (see defense below) to fail with your own clearer error.
Example fix
# before provider.execute(inst, code, timeout=max(0, int(remaining))) # remaining=0 -> RuntimeError # after provider.execute(inst, code, timeout=max(1, int(remaining)))
Defensive patterns
Strategy: validation
Validate before calling
resolved = provider.timeout if timeout is None else int(timeout)
if resolved <= 0:
raise ValueError(f"timeout must be > 0, got {resolved}")
result = provider.execute(instance_id, code, timeout=resolved) Type guard
def is_positive_timeout(timeout) -> bool:
try:
return int(timeout) > 0
except (TypeError, ValueError):
return False Try / catch
try:
result = provider.execute(instance_id, code, timeout=timeout)
except RuntimeError as e:
if "must be greater than 0" in str(e):
result = provider.execute(instance_id, code) # fall back to configured default
else:
raise Prevention
- Clamp deadline-derived timeouts: max(1, int(remaining)).
- Remember int(0.5) == 0 — floats below 1 are rejected too.
- Validate timeout at the agent layer so users see a clear message instead of a provider RuntimeError.
When it happens
Trigger: Calling execute with timeout=0, a negative timeout, or a string like '-1' that int() accepts; or configuring the provider with timeout<=0 so the default itself is invalid.
Common situations: Agents computing timeout from a remaining-budget value that hits 0 under deadline pressure; config templates that set timeout: 0 intending 'no wait'; passing timeout as float seconds smaller than 1 (int(0.5) == 0).
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Execution timeout must be greater than 0 seconds, got {reque
- Invalid UCloud Agent Sandbox configuration.
- Unsupported language for UCloud Agent Sandbox provider: {tem
- Timed out while creating a UCloud Agent Sandbox.
- Execution timed out after {exec_timeout} seconds
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/c79ba5c72b51df99.
Report an issue: GitHub.