{"record":{"id":"ee0094e98cb63709","repo":"Hmbown/CodeWhale","slug":"antigravity-cloud-code-sse-is-not-json-err","errorCode":null,"errorMessage":"Antigravity cloud-code SSE is not JSON: {err}","messagePattern":"Antigravity cloud-code SSE is not JSON: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/cloud_code.rs","lineNumber":218,"sourceCode":"                        Ok(None) => break,\n                        Err(err) => {\n                            yield Err(anyhow::anyhow!(\"{err}\"));\n                            return;\n                        }\n                    };\n                    if line.is_empty() || line.starts_with(':') {\n                        continue;\n                    }\n                    let Some(data) = super::extract_sse_data_value(&line) else {\n                        continue;\n                    };\n                    if data == \"[DONE]\" {\n                        break;\n                    }\n                    let value: Value = match serde_json::from_str(data) {\n                        Ok(value) => value,\n                        Err(err) => {\n                            yield Err(anyhow::anyhow!(\n                                \"Antigravity cloud-code SSE is not JSON: {err}\"\n                            ));\n                            return;\n                        }\n                    };\n                    if let Some(error) = value.get(\"error\") {\n                        yield Ok(StreamEvent::Error {\n                            error: error.clone(),\n                        });\n                        return;\n                    }\n                    let Some(text) = extract_cloud_code_text(&value) else {\n                        if value.get(\"response\").is_some() || value.get(\"candidates\").is_some() {\n                            continue;\n                        }\n                        yield Err(anyhow::anyhow!(\n                            \"Antigravity cloud-code SSE shape is unproven; failing closed\"\n                        ));","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/client/cloud_code.rs#L200-L236","documentation":"On the Antigravity cloud-code route, a `data:` payload (after the `[DONE]` check) failed `serde_json::from_str`. The client fails closed and terminates the stream rather than skipping a frame it cannot interpret.","triggerScenarios":"A truncated or rewritten SSE payload from an intermediary; the endpoint emitting a non-JSON data line; in-transit corruption making the line unparseable.","commonSituations":"Proxies buffering/mangling SSE; provider serialization bug; flaky network corrupting a line.","solutions":["Retry the request — truncation is usually transient","Capture the raw data line to see whether it is truncated JSON or non-JSON content","Bypass intermediaries; verify the endpoint","If deterministic, report upstream with the captured payload"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_cloud_code_json_error(err: &anyhow::Error) -> bool {\n    err.to_string().starts_with(\"Antigravity cloud-code SSE is not JSON\")\n}","tryCatchPattern":"match stream.next().await {\n    Some(Err(e)) if is_cloud_code_json_error(&e) => {\n        log::warn!(\"bad cloud-code frame: {e}\");\n        backoff_retry().await; // truncation is usually transient\n    }\n    Some(Err(e)) => return Err(e),\n    other => { /* forward */ }\n}","preventionTips":["Capture the raw data line when this fires so the payload is reportable","Retry once for truncation-class failures before investigating","Avoid SSE-buffering proxies on the cloud-code route"],"tags":["antigravity","cloud-code","sse","json","parsing"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}