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 execute_code() when the caller-supplied timeout (or the provider default self.timeout when timeout is None) is zero or negative after int() coercion. It is a pure argument-validation error raised before any sandbox command runs.
Source
Thrown at agent/sandbox/providers/tenki.py:209
arguments: Optional[Dict[str, Any]] = None,
) -> ExecutionResult:
if not self._initialized:
raise RuntimeError("Provider not initialized. Call initialize() first.")
if instance_id not in self._instances:
raise RuntimeError(f"Unknown Tenki 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"]
errors = self._tenki_errors()
args_json = json.dumps(arguments or {}, ensure_ascii=False)
script_path, argv = self._prepare_script(sandbox, remote_work_dir, normalized_lang, code, args_json)
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)
start_time = time.time()
try:
result = sandbox.exec(*argv, cwd=remote_work_dir, timeout=exec_timeout)
except (errors.CommandTimeoutError, errors.PrimitiveTimeoutError) as exc:
logger.warning("Tenki execution timed out (instance=%s, timeout=%ss)", instance_id, exec_timeout)
raise TimeoutError(f"Execution timed out after {exec_timeout} seconds") from exc
except (errors.SessionTerminatedError, errors.SessionNotFoundError) as exc:
# The sandbox was reclaimed (e.g. max_lifetime) or lost mid-run;
# surface it as RuntimeError per the base contract, not an SDK type.
raise RuntimeError(f"Tenki sandbox is no longer available: {exc}") from exc
except Exception as exc:
raise RuntimeError(f"Tenki execution failed: {exc}") from exc
execution_time = time.time() - start_time
stdout = result.stdout_text
stderr = result.stderr_textView on GitHub (pinned to 554fb1133a)
Solutions
- Pass a positive integer timeout, or None to use the provider's configured self.timeout.
- Clamp computed timeouts: max(1, int(remaining)) before calling execute_code().
- If you intended 'no limit', raise the provider config timeout instead of passing 0.
Example fix
# before provider.execute_code(instance_id, code, timeout=max(0, deadline - time.time())) # after provider.execute_code(instance_id, code, timeout=max(1, int(deadline - time.time())))
Defensive patterns
Strategy: validation
Validate before calling
timeout = None if timeout in (None,) else int(timeout)
if timeout is not None and timeout <= 0:
raise ValueError("timeout must be > 0; pass None for provider default") Type guard
def is_valid_timeout(t) -> bool:
return t is None or (isinstance(t, int) and not isinstance(t, bool) and t > 0) Prevention
- Clamp computed deadlines: max(1, int(remaining)).
- Use None (not 0) to request the provider-configured default timeout.
- Validate caller-supplied timeout at the API boundary before it reaches the sandbox layer.
When it happens
Trigger: Calling execute_code(instance_id, code, timeout=0) or a negative timeout; or a caller-computed timeout that evaluates to <= 0 (e.g. a deadline already passed) while the provider default is overridden.
Common situations: Passing a remaining-seconds value derived from an expired deadline, mapping a 0/'unlimited' convention from another API onto this provider (here 0 is invalid — pass None for the configured default), or config files with timeout: 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
- Execution timeout must be greater than 0 seconds, got {reque
- Invalid Tenki provider configuration.
- Execution timed out after {exec_timeout} seconds
- Unsupported language for Tenki provider: {language}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/07cebb8dc4327357.
Report an issue: GitHub.