{"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/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/client/cloud_code.rs#L161-L197","documentation":"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.","triggerScenarios":"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.","commonSituations":"Unstable networks during long agentic generations; corporate proxies limiting cloud endpoints; expired Antigravity/Google credentials causing mid-body disconnects.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust: retry transient cloud-code transport resets; re-auth on repeat failures\nErr(err) if err.to_string().starts_with(\"Stream read error\") && attempt < 2 => {\n    attempt += 1;\n    continue;\n}\nErr(err) if err.to_string().starts_with(\"Stream read error\") => {\n    refresh_cloud_code_credentials().await?; // recurring resets often mean expired auth\n    return Err(err);\n}\n","preventionTips":["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."],"tags":["sse","streaming","network","cloud-code","antigravity","connection-reset"],"backgroundTag":"mid-stream-connection-reset","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}