{"record":{"id":"dcdce5cc32727fda","repo":"FoundationAgents/OpenManus","slug":"command-execution-timed-out-after-timeout-or-self","errorCode":null,"errorMessage":"Command execution timed out after {timeout or self.config.timeout} seconds","messagePattern":"Command execution timed out after (.+?) seconds","errorType":"exception","errorClass":"SandboxTimeoutError","httpStatus":null,"severity":"warning","filePath":"app/sandbox/core/sandbox.py","lineNumber":162,"sourceCode":"            cmd: Command to execute.\n            timeout: Timeout in seconds.\n\n        Returns:\n            Command output as string.\n\n        Raises:\n            RuntimeError: If sandbox not initialized or command execution fails.\n            TimeoutError: If command execution times out.\n        \"\"\"\n        if not self.terminal:\n            raise RuntimeError(\"Sandbox not initialized\")\n\n        try:\n            return await self.terminal.run_command(\n                cmd, timeout=timeout or self.config.timeout\n            )\n        except TimeoutError:\n            raise SandboxTimeoutError(\n                f\"Command execution timed out after {timeout or self.config.timeout} seconds\"\n            )\n\n    async def read_file(self, path: str) -> str:\n        \"\"\"Reads a file from the container.\n\n        Args:\n            path: File path.\n\n        Returns:\n            File contents as string.\n\n        Raises:\n            FileNotFoundError: If file does not exist.\n            RuntimeError: If read operation fails.\n        \"\"\"\n        if not self.container:\n            raise RuntimeError(\"Sandbox not initialized\")","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/sandbox/core/sandbox.py#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nout = await sandbox.run_command(\"pip install -r requirements.txt\")\n\n# after\nout = await sandbox.run_command(\"pip install -r requirements.txt\", timeout=600)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from app.sandbox.core.exceptions import SandboxTimeoutError\ntry:\n    out = await sandbox.run_command(cmd, timeout=120)\nexcept SandboxTimeoutError:\n    out = await sandbox.run_command(cmd + \" < /dev/null\", timeout=600)  # non-interactive, longer budget","preventionTips":["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"],"tags":["sandbox","timeout","exec","long-running-command"],"backgroundTag":null,"analyzedSha":"52a13f2a57d8c7f6737eefb02ccf569594d44273","analyzedAt":"2026-08-15T02:33:49.993Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}