{"record":{"id":"4919144a674b6859","repo":"Hmbown/CodeWhale","slug":"sse-stream-idle-timeout-after-s-no-data-receiv-491914","errorCode":null,"errorMessage":"SSE stream idle timeout after {}s — no data received (bytes_received={}, stream_age_ms={}, ms_since_last_chunk={})","messagePattern":"SSE stream idle timeout after (.+?)s — no data received \\(bytes_received=(.+?), stream_age_ms=(.+?), ms_since_last_chunk=(.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/cloud_code.rs","lineNumber":184,"sourceCode":"        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 {\n                    let line = match super::take_sse_line(&mut buffer) {\n                        Ok(Some(line)) => line,\n                        Ok(None) => break,\n                        Err(err) => {\n                            yield Err(anyhow::anyhow!(\"{err}\"));","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/client/cloud_code.rs#L166-L202","documentation":"On the Antigravity cloud-code route, the tokio timeout around the next chunk elapsed: no bytes arrived within the idle window. The message is built by the shared `stream_entry::idle_timeout_message` and reports idle seconds, bytes received, stream age, and time since the last chunk, distinguishing never-started from stalled-mid-stream.","triggerScenarios":"Long server-side thinking phase before the first cloud-code event; stalled proxy; provider hang after 200 OK; idle timeout smaller than the route's time-to-first-byte.","commonSituations":"Heavy agentic tasks with long silent planning phases; mobile/high-latency networks; proxies idle-killing quiet SSE connections.","solutions":["Retry — silent stalls are usually transient","Raise the stream idle timeout above the route's expected time-to-first-event","If bytes_received=0 always, verify the endpoint/auth — the server never starts","Bypass intermediaries that idle-kill quiet connections"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"fn is_idle_timeout(err: &anyhow::Error) -> bool {\n    err.to_string().contains(\"idle timeout after\")\n}","tryCatchPattern":"match stream.next().await {\n    Some(Err(e)) if is_idle_timeout(&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":["Size the stream idle timeout for the cloud-code route's long silent planning phases","Use the embedded diagnostics to distinguish never-started (bytes_received=0) from stalled streams","Avoid idle-killing proxies on long agentic sessions"],"tags":["antigravity","cloud-code","timeout","network","streaming"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}