Hmbown/CodeWhale · error
Cloud agent harness execution failed
Error message
Cloud agent harness execution failed (HTTP {status}). What it means
Thrown by `run_harness` when the sandbox toolbox `POST process/execute` call returns a non-2xx HTTP status. The harness command was dispatched to the sandbox but the toolbox itself rejected or failed the execution request — this is a transport/API-level failure, distinct from the harness command merely exiting non-zero (error 783).
Solutions
- Retry the job — transient toolbox failures and mid-run reaps are the most common cause.
- Check the sandbox state in the provider dashboard; if it is destroyed/stopped, the job must be re-dispatched on a fresh sandbox.
- For 4xx statuses, confirm the installed provider matches the expected `process/execute` contract ({command, cwd, timeout}); a provider version change may require upgrading the tool.
- If long commands routinely fail, lower per-command timeout_secs or split the work so requests fit the provider's request limits.
Defensive patterns
Strategy: retry
Try / catch
match result {
Err(e) if e.to_string().contains("harness execution failed") => {
// sandbox may have been reaped; re-dispatch on a fresh sandbox
retry_on_fresh_sandbox(job)
}
other => other,
} Prevention
- Keep the sandbox active during long turns (the code already raises the request budget — do not shrink it back to the 120s cap).
- Split very long commands into smaller harness steps.
- Retry on a fresh sandbox; treat the failed sandbox as lost.
- Watch for provider 4xx changes that indicate an API contract drift.
When it happens
Trigger: Dispatching a harness command when the toolbox returns non-success: sandbox was reaped/terminated mid-run (404/5xx), the request exceeded the harness budget timeout, toolbox is unhealthy, or the request payload was rejected (4xx).
Common situations: Long-running agent turns whose sandbox idle-timed out at the provider; Daytona capacity/instance failure mid-job; network interruption during a multi-minute harness request; provider API contract change causing 422.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Cloud agent repository clone failed
- Cloud agent create failed
- Cloud agent harness exited with code
- cloud agent label apply failed
- Cloud agent sandbox disappeared before it was ready.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/f768a1d21d81d05c.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/cloud_dispatch.rs:1665
"command": shell_quote_join(&command.argv),
"cwd": command.cwd,
"timeout": command.timeout_secs,
});
// This call carries the declared turn budget (an hour for the agent
// entry), so it asks for that budget plus slack per request — never the
// 120s control-plane cap that used to bound it.
let response = Self::send_json_on(
&Self::blocking_client()?,
Self::harness_client_budget_secs(command),
reqwest::Method::POST,
&url,
&api_key,
body,
)?;
let status = response.status();
let text = response.text().unwrap_or_default();
if !status.is_success() {
bail!("Cloud agent harness execution failed (HTTP {status}).");
}
let parsed: serde_json::Value = serde_json::from_str(&text)
.context("the sandbox returned an unreadable harness result")?;
let exit_code = parsed
.get("exitCode")
.and_then(serde_json::Value::as_i64)
.unwrap_or(0);
let result = parsed
.get("result")
.and_then(serde_json::Value::as_str)
.unwrap_or("");
if exit_code != 0 {
bail!(
"Cloud agent harness exited with code {exit_code}: {}",
sanitize_error(result)
);
}
Ok(result.chars().take(MAX_HARNESS_OUTPUT_CHARS).collect())View on GitHub (pinned to 73e0f67d83)