{"record":{"id":"8f5818f479afd543","repo":"Hmbown/CodeWhale","slug":"stream-read-error-e-8f5818","errorCode":null,"errorMessage":"Stream read error: {e}","messagePattern":"Stream read error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/cloud_code.rs","lineNumber":179,"sourceCode":"            );\n            bail!(\"Antigravity cloud-code HTTP {status}: {redacted}\");\n        }\n\n        let stream_idle_timeout = self.stream_idle_timeout;\n        let byte_stream = response.bytes_stream();\n        let stream = async_stream::stream! {\n            let mut buffer: Vec<u8> = Vec::new();\n            let stream_start = std::time::Instant::now();\n            let mut last_chunk_at = std::time::Instant::now();\n            let mut bytes_received: usize = 0;\n            let mut started = false;\n            tokio::pin!(byte_stream);\n\n            loop {\n                let chunk = match tokio::time::timeout(stream_idle_timeout, byte_stream.next()).await {\n                    Ok(Some(Ok(chunk))) => chunk,\n                    Ok(Some(Err(e))) => {\n                        yield Err(anyhow::anyhow!(\"Stream read error: {e}\"));\n                        return;\n                    }\n                    Ok(None) => break,\n                    Err(_) => {\n                        yield Err(anyhow::anyhow!(stream_entry::idle_timeout_message(\n                            stream_idle_timeout,\n                            bytes_received,\n                            stream_start.elapsed(),\n                            last_chunk_at.elapsed(),\n                        )));\n                        return;\n                    }\n                };\n                bytes_received += chunk.len();\n                last_chunk_at = std::time::Instant::now();\n                buffer.extend_from_slice(&chunk);\n\n                loop {","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/client/cloud_code.rs#L161-L197","documentation":"On the Antigravity cloud-code route, the HTTP body stream returned an error mid-read (the `Ok(Some(Err(e)))` arm of the chunk read). The client yields this error and returns, ending the stream; unlike the chat route it does not log a source-chain diagnostic here.","triggerScenarios":"Connection reset or RST_STREAM during the cloud-code SSE body; decompression failure; proxy cutting the long-lived stream.","commonSituations":"Long agentic cloud-code sessions behind proxies/VPNs; unstable networks; Google-side connection recycling.","solutions":["Retry the request — transient transport errors dominate","Check network path and bypass intermediaries if it recurs","If deterministic at the same point, capture request size — an intermediary body-size or time limit may be in play"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_stream_read_error(err: &anyhow::Error) -> bool {\n    err.to_string().starts_with(\"Stream read error\")\n}","tryCatchPattern":"match stream.next().await {\n    Some(Err(e)) if is_stream_read_error(&e) => {\n        backoff().await;\n        stream = client.reopen_cloud_code_stream(request).await?;\n    }\n    Some(Err(e)) => return Err(e),\n    other => { /* forward */ }\n}","preventionTips":["Retry transient transport errors on the cloud-code route with backoff","Keep cloud-code sessions short enough to survive proxy connection limits","Bypass intermediaries that cut long-lived SSE connections"],"tags":["antigravity","cloud-code","network","streaming"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}