Hmbown/CodeWhale · error · anyhow::Error
The Codewhale service returned an unexpectedly large…
Error message
The Codewhale service returned an unexpectedly large response
What it means
The cloud client reads the Codewhale service HTTP response body with a hard cap of MAX_RESPONSE_BYTES. It reads exactly one byte beyond the cap; if that extra byte exists, the response is too large and this error is thrown instead of buffering unbounded data.
Solutions
- Check that the account API origin is the correct Codewhale service URL.
- Retry — a misconfigured intermediary may be serving an error page; inspect it with curl.
- Report the endpoint to the service operator if the response is legitimately that large.
- If using a local/dev origin, verify it is not returning debug dumps.
Defensive patterns
Strategy: try-catch
Try / catch
// Rust
match cloud.execute(req) {
Err(e) if e.to_string().contains("unexpectedly large response") => {
// inspect the origin with curl; likely a proxy/error page, not real data
}
other => other,
} Prevention
- Point the CLI at the genuine Codewhale service origin.
- Inspect unusual responses with curl before scripting against them.
- Keep response payloads bounded on the service side.
When it happens
Trigger: Any authenticated or unauthenticated call to the Codewhale service whose response body exceeds MAX_RESPONSE_BYTES (execute → all cloud API calls funnel through it).
Common situations: A broken/misbehaving service endpoint returning a huge dump; a proxy returning an HTML error page or redirect loop with a large body; pointing the CLI at the wrong origin that streams unbounded data.
Understand the failure class
Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.
Related errors
- Cloud agent create failed
- Cloud agent harness execution failed
- cloud agent label apply failed
- Cloud agent repository clone failed
- Cloud agent sandbox listing failed
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/e1817bc930954a4a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/cloud.rs:297
.header(reqwest::header::CONTENT_TYPE, "application/json")
.body(body);
}
let response = builder
.send()
.context("could not reach the Codewhale service")?;
let status = response.status().as_u16();
let retry_after = response
.headers()
.get(reqwest::header::RETRY_AFTER)
.and_then(|value| value.to_str().ok())
.and_then(|value| value.trim().parse::<u64>().ok());
let mut body = Vec::new();
response
.take(MAX_RESPONSE_BYTES + 1)
.read_to_end(&mut body)
.context("failed to read the Codewhale service response")?;
if body.len() as u64 > MAX_RESPONSE_BYTES {
bail!("The Codewhale service returned an unexpectedly large response");
}
Ok(CloudResponse {
status,
body,
retry_after,
})
}
}
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
struct DeviceStart {
device_code: String,
user_code: String,
verification_uri: String,
verification_uri_complete: String,
expires_in: u64,
interval: u64,View on GitHub (pinned to 73e0f67d83)