{"record":{"id":"d13d75f545f60536","repo":"Hmbown/CodeWhale","slug":"command-timed-out-after-ms","errorCode":null,"errorMessage":"Command timed out after {}ms","messagePattern":"Command timed out after (.+?)ms","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":10604,"sourceCode":"            print!(\"{}\", String::from_utf8_lossy(&stdout));\n        }\n        if !stderr.is_empty() {\n            eprint!(\"{stderr_str}\");\n        }\n        if sandbox_denied {\n            eprintln!(\n                \"{}\",\n                SandboxManager::denial_message(sandbox_type, &stderr_str)\n            );\n        }\n\n        if !status.success() {\n            bail!(\"Command failed with exit code {exit_code}\");\n        }\n    } else {\n        let _ = child.kill();\n        let _ = child.wait();\n        bail!(\"Command timed out after {}ms\", timeout.as_millis());\n    }\n    Ok(())\n}\n\nfn parse_sandbox_policy(\n    policy: &str,\n    network: bool,\n    writable_root: Vec<PathBuf>,\n    exclude_tmpdir: bool,\n    exclude_slash_tmp: bool,\n) -> Result<crate::sandbox::SandboxPolicy> {\n    use crate::sandbox::SandboxPolicy;\n\n    match policy {\n        \"danger-full-access\" => Ok(SandboxPolicy::DangerFullAccess),\n        \"read-only\" => Ok(SandboxPolicy::ReadOnly),\n        \"external-sandbox\" => Ok(SandboxPolicy::ExternalSandbox {\n            network_access: network,","sourceCodeStart":10586,"sourceCodeEnd":10622,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L10586-L10622","documentation":"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.","triggerScenarios":"A command spawned through the sandbox runner exceeds `timeout` — the wait branch's timeout elapses, `child.kill()`/`wait()` run, and the bail fires.","commonSituations":"Long builds, network stalls under sandboxed (often network-denied) execution, interactive prompts waiting on stdin that will never be answered.","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."],"exampleFix":"// before\nrun_sandboxed(cmd, timeout = Duration::from_millis(30_000))\n// after\nrun_sandboxed(cmd, timeout = Duration::from_millis(300_000))","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"loop {\n    match run_sandboxed(cmd, timeout) {\n    | Err(e) if e.to_string().contains(\"Command timed out\") && retries < 2 => { retries += 1; timeout *= 2; }\n    | other => break other,\n    }\n}\n","preventionTips":["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."],"tags":["sandbox","timeout","process","cli"],"backgroundTag":"request-timeout","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}