{"record":{"id":"f768a1d21d81d05c","repo":"Hmbown/CodeWhale","slug":"cloud-agent-harness-execution-failed-http-status","errorCode":null,"errorMessage":"Cloud agent harness execution failed (HTTP {status}).","messagePattern":"Cloud agent harness execution failed \\(HTTP (.+?)\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/cloud_dispatch.rs","lineNumber":1665,"sourceCode":"            \"command\": shell_quote_join(&command.argv),\n            \"cwd\": command.cwd,\n            \"timeout\": command.timeout_secs,\n        });\n        // This call carries the declared turn budget (an hour for the agent\n        // entry), so it asks for that budget plus slack per request — never the\n        // 120s control-plane cap that used to bound it.\n        let response = Self::send_json_on(\n            &Self::blocking_client()?,\n            Self::harness_client_budget_secs(command),\n            reqwest::Method::POST,\n            &url,\n            &api_key,\n            body,\n        )?;\n        let status = response.status();\n        let text = response.text().unwrap_or_default();\n        if !status.is_success() {\n            bail!(\"Cloud agent harness execution failed (HTTP {status}).\");\n        }\n        let parsed: serde_json::Value = serde_json::from_str(&text)\n            .context(\"the sandbox returned an unreadable harness result\")?;\n        let exit_code = parsed\n            .get(\"exitCode\")\n            .and_then(serde_json::Value::as_i64)\n            .unwrap_or(0);\n        let result = parsed\n            .get(\"result\")\n            .and_then(serde_json::Value::as_str)\n            .unwrap_or(\"\");\n        if exit_code != 0 {\n            bail!(\n                \"Cloud agent harness exited with code {exit_code}: {}\",\n                sanitize_error(result)\n            );\n        }\n        Ok(result.chars().take(MAX_HARNESS_OUTPUT_CHARS).collect())","sourceCodeStart":1647,"sourceCodeEnd":1683,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/cloud_dispatch.rs#L1647-L1683","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"harness execution failed\") => {\n        // sandbox may have been reaped; re-dispatch on a fresh sandbox\n        retry_on_fresh_sandbox(job)\n    }\n    other => other,\n}","preventionTips":["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."],"tags":["http","cloud","sandbox","harness"],"backgroundTag":"http-error-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T21:17:16.096Z"}