{"record":{"id":"03a973cb1b624470","repo":"Hmbown/CodeWhale","slug":"opensandbox-returned-http","errorCode":null,"errorMessage":"OpenSandbox returned HTTP {}: {}","messagePattern":"OpenSandbox returned HTTP (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/sandbox/opensandbox.rs","lineNumber":102,"sourceCode":"            cmd: cmd.to_string(),\n            env: env.clone(),\n        };\n\n        let mut req = self.client.post(self.run_url()).json(&request_body);\n\n        if let Some(ref api_key) = self.api_key {\n            req = req.bearer_auth(api_key);\n        }\n\n        let response = req\n            .send()\n            .await\n            .context(\"Failed to reach OpenSandbox endpoint\")?;\n\n        let status = response.status();\n        if !status.is_success() {\n            let body = response.text().await.unwrap_or_default();\n            anyhow::bail!(\"OpenSandbox returned HTTP {}: {}\", status.as_u16(), body);\n        }\n\n        let parsed: SandboxRunResponse = response\n            .json()\n            .await\n            .context(\"Failed to parse OpenSandbox response\")?;\n\n        Ok(SandboxOutput {\n            stdout: parsed.stdout,\n            stderr: parsed.stderr,\n            exit_code: parsed.exit_code,\n        })\n    }\n}\n","sourceCodeStart":84,"sourceCodeEnd":117,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/sandbox/opensandbox.rs#L84-L117","documentation":"The OpenSandbox HTTP endpoint answered with a non-success status while executing a command in the sandbox. The client includes the HTTP status code and the response body (best-effort) in the error so the server-side failure reason is visible. The request itself reached the server; it is the server rejecting or failing the run request.","triggerScenarios":"POST to the OpenSandbox run endpoint returns 4xx/5xx during SandboxBackend::exec; response.text() is read and bubbled into anyhow::bail! before JSON parsing.","commonSituations":"401/403 from an expired or wrong API token; 404 from a wrong endpoint URL or stale server version; 429 rate limiting; 500 from a sandbox image that failed to start or a server-side crash.","solutions":["Read the status code and body in the error message to identify the server-side cause.","For 401/403, refresh the OpenSandbox credentials/token configured for the endpoint.","For 404, verify the endpoint URL matches the deployed OpenSandbox server version.","For 429, back off and retry; for 5xx, inspect OpenSandbox server logs and retry once the service recovers.","Use the fallback backend (`sandbox_backend = none`) locally if OpenSandbox is down and sandboxing is not required."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: ensure endpoint configured and reachable\nif endpoint.is_empty() { bail(\"OpenSandbox endpoint not configured\"); }\nlet ok = reqwest::Client::new().get(format!(\"{endpoint}/health\")).send().await.map(|r| r.status().is_success()).unwrap_or(false);\nif !ok { bail(\"OpenSandbox endpoint unreachable or unhealthy\"); }","typeGuard":null,"tryCatchPattern":"match sandbox.exec(cmd, env).await {\n    Err(e) if e.to_string().contains(\"OpenSandbox returned HTTP\") => {\n        log::warn!(\"OpenSandbox HTTP failure: {e:#}\");\n        // inspect status; retry on 429/5xx with backoff, else surface to user\n    }\n    other => other?,\n}","preventionTips":["Check token expiry and endpoint URL before long sessions.","Add retries with backoff for 429 and transient 5xx.","Monitor OpenSandbox server health and fall back to sandbox_backend=none when it is degraded."],"tags":["network","http","sandbox"],"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-23T08:17:48.524Z"}