FoundationAgents/OpenManus · warning · SandboxTimeoutError
Command execution timed out after {timeout or self.config.ti
Error message
Command execution timed out after {timeout or self.config.timeout} seconds What it means
Raised as SandboxTimeoutError (app/sandbox/core/exceptions.py:12) by DockerSandbox.run_command (app/sandbox/core/sandbox.py:162) when AsyncDockerizedTerminal.run_command raises TimeoutError: the command did not finish within `timeout or self.config.timeout` seconds. The configured/per-call timeout is echoed in the message. The exec may still be running in the container — the timeout only abandons waiting.
Source
Thrown at app/sandbox/core/sandbox.py:162
cmd: Command to execute.
timeout: Timeout in seconds.
Returns:
Command output as string.
Raises:
RuntimeError: If sandbox not initialized or command execution fails.
TimeoutError: If command execution times out.
"""
if not self.terminal:
raise RuntimeError("Sandbox not initialized")
try:
return await self.terminal.run_command(
cmd, timeout=timeout or self.config.timeout
)
except TimeoutError:
raise SandboxTimeoutError(
f"Command execution timed out after {timeout or self.config.timeout} seconds"
)
async def read_file(self, path: str) -> str:
"""Reads a file from the container.
Args:
path: File path.
Returns:
File contents as string.
Raises:
FileNotFoundError: If file does not exist.
RuntimeError: If read operation fails.
"""
if not self.container:
raise RuntimeError("Sandbox not initialized")View on GitHub (pinned to 52a13f2a57)
Solutions
- Pass a larger per-call timeout: await sandbox.run_command(cmd, timeout=600).
- Raise the default in SandboxSettings (config.timeout) for known-slow operations.
- For interactive or very long jobs, run in background (nohup ... &) and poll for the output file instead of blocking run_command.
- Make sure the command is non-interactive: close stdin, pass -y/--yes flags, redirect stdin from /dev/null.
Example fix
# before
out = await sandbox.run_command("pip install -r requirements.txt")
# after
out = await sandbox.run_command("pip install -r requirements.txt", timeout=600) Defensive patterns
Strategy: try-catch
Try / catch
from app.sandbox.core.exceptions import SandboxTimeoutError
try:
out = await sandbox.run_command(cmd, timeout=120)
except SandboxTimeoutError:
out = await sandbox.run_command(cmd + " < /dev/null", timeout=600) # non-interactive, longer budget Prevention
- Pass explicit timeouts sized to the command (installs/builds need minutes)
- Close stdin or redirect from /dev/null for non-interactive commands
- Run very long jobs detached and poll for completion
- Raise config.timeout default if most commands exceed it
When it happens
Trigger: Long-running commands (pip install, builds, test suites) exceeding the default config.timeout; commands that block on stdin because they were never given input; hung network calls inside the container; per-call timeout argument smaller than the command needs.
Common situations: Default sandbox timeout (often 30–60s) too low for package installs; `python` invoked without -c/-i flags waiting on stdin; container has no network so apt/pip hang until timeout; CI cold cache making first runs slow.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Command '{cmd}' timed out after {timeout} seconds in sandbox
- password must be provided
- Maximum number of sandboxes ({self.max_sandboxes}) reached
- Failed to create sandbox: {e}
- Failed to create sandbox: {e}
AI-assisted analysis of FoundationAgents/OpenManus@52a13f2a57 (2026-08-15).
Data as JSON: /api/errors/dcdce5cc32727fda.
Report an issue: GitHub.