Hmbown/CodeWhale · error · anyhow::Error
Command timed out after
Error message
Command timed out after {}ms What it means
The sandboxed command did not finish within the allotted timeout, so the runner kills the child, reaps it, and bails with the elapsed timeout in milliseconds. This is a deliberate stop to prevent a hung command from blocking the session indefinitely.
Solutions
- Increase the timeout parameter for this command if it legitimately needs longer.
- Check whether the sandbox policy denies network access and causes the command to hang; enable network if needed.
- Make the command non-interactive (pipe input, pass flags) so it cannot block waiting on stdin.
Example fix
// before run_sandboxed(cmd, timeout = Duration::from_millis(30_000)) // after run_sandboxed(cmd, timeout = Duration::from_millis(300_000))
Defensive patterns
Strategy: retry
Try / catch
loop {
match run_sandboxed(cmd, timeout) {
| Err(e) if e.to_string().contains("Command timed out") && retries < 2 => { retries += 1; timeout *= 2; }
| other => break other,
}
}
Prevention
- Size timeouts from measured runtimes, not guesses; allow headroom for cold caches.
- Never leave the command waiting on stdin; pipe input or add non-interactive flags.
- Ensure the sandbox policy grants network when the command needs it — denial often manifests as a hang.
When it happens
Trigger: A command spawned through the sandbox runner exceeds `timeout` — the wait branch's timeout elapses, `child.kill()`/`wait()` run, and the bail fires.
Common situations: Long builds, network stalls under sandboxed (often network-denied) execution, interactive prompts waiting on stdin that will never be answered.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Command failed with exit code
- Cannot resolve current binary path
- Cloud agent harness exited with code
- Command is required
- dsh exited with status
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/d13d75f545f60536.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:10604
print!("{}", String::from_utf8_lossy(&stdout));
}
if !stderr.is_empty() {
eprint!("{stderr_str}");
}
if sandbox_denied {
eprintln!(
"{}",
SandboxManager::denial_message(sandbox_type, &stderr_str)
);
}
if !status.success() {
bail!("Command failed with exit code {exit_code}");
}
} else {
let _ = child.kill();
let _ = child.wait();
bail!("Command timed out after {}ms", timeout.as_millis());
}
Ok(())
}
fn parse_sandbox_policy(
policy: &str,
network: bool,
writable_root: Vec<PathBuf>,
exclude_tmpdir: bool,
exclude_slash_tmp: bool,
) -> Result<crate::sandbox::SandboxPolicy> {
use crate::sandbox::SandboxPolicy;
match policy {
"danger-full-access" => Ok(SandboxPolicy::DangerFullAccess),
"read-only" => Ok(SandboxPolicy::ReadOnly),
"external-sandbox" => Ok(SandboxPolicy::ExternalSandbox {
network_access: network,View on GitHub (pinned to 73e0f67d83)