Hmbown/CodeWhale · error
Stream read error
Error message
Stream read error: {e} What it means
The Antigravity cloud-code SSE adapter wraps each body-stream read in a timeout; when reqwest/hyper itself returns Err (as opposed to the timeout elapsing), the stream yields 'Stream read error' with the top-level message and terminates. Unlike the chat adapter, this path does not build a logged source chain, so the yielded message is the starting point for diagnosis.
Solutions
- Retry the request; transient resets dominate.
- If resets recur, re-authenticate the cloud-code credentials and verify the endpoint is reachable outside the proxy.
- Force HTTP/1.1 or bypass the intermediary if HTTP/2 resets are visible in network logs.
- Check the provider status page for the Antigravity backend.
Defensive patterns
Strategy: retry
Try / catch
// Rust: retry transient cloud-code transport resets; re-auth on repeat failures
Err(err) if err.to_string().starts_with("Stream read error") && attempt < 2 => {
attempt += 1;
continue;
}
Err(err) if err.to_string().starts_with("Stream read error") => {
refresh_cloud_code_credentials().await?; // recurring resets often mean expired auth
return Err(err);
}
Prevention
- Keep cloud-code OAuth credentials fresh for long sessions.
- Route cloud-code traffic around intermediaries that abort long-lived responses.
- Retry idempotent turns once before investigating.
When it happens
Trigger: Connection reset or HTTP/2 GOAWAY mid-stream on the cloud-code route; TLS error during body transfer; a proxy aborting the response body; credential expiry surfacing as a mid-body disconnect.
Common situations: Unstable networks during long agentic generations; corporate proxies limiting cloud endpoints; expired Antigravity/Google credentials causing mid-body disconnects.
Related errors
- SSE stream idle timeout after
- Antigravity cloud-code SSE is not JSON
- Antigravity cloud-code SSE shape is unproven; failing closed
- Antigravity cloud-code stream ended without a text part
- {err}
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/8f5818f479afd543.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/client/cloud_code.rs:179
);
bail!("Antigravity cloud-code HTTP {status}: {redacted}");
}
let stream_idle_timeout = self.stream_idle_timeout;
let byte_stream = response.bytes_stream();
let stream = async_stream::stream! {
let mut buffer: Vec<u8> = Vec::new();
let stream_start = std::time::Instant::now();
let mut last_chunk_at = std::time::Instant::now();
let mut bytes_received: usize = 0;
let mut started = false;
tokio::pin!(byte_stream);
loop {
let chunk = match tokio::time::timeout(stream_idle_timeout, byte_stream.next()).await {
Ok(Some(Ok(chunk))) => chunk,
Ok(Some(Err(e))) => {
yield Err(anyhow::anyhow!("Stream read error: {e}"));
return;
}
Ok(None) => break,
Err(_) => {
yield Err(anyhow::anyhow!(stream_entry::idle_timeout_message(
stream_idle_timeout,
bytes_received,
stream_start.elapsed(),
last_chunk_at.elapsed(),
)));
return;
}
};
bytes_received += chunk.len();
last_chunk_at = std::time::Instant::now();
buffer.extend_from_slice(&chunk);
loop {View on GitHub (pinned to 0c42157ee5)