Hmbown/CodeWhale · error
Antigravity cloud-code SSE is not JSON: {err}
Error message
Antigravity cloud-code SSE is not JSON: {err} What it means
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.
Source
Thrown at crates/tui/src/client/cloud_code.rs:218
Ok(None) => break,
Err(err) => {
yield Err(anyhow::anyhow!("{err}"));
return;
}
};
if line.is_empty() || line.starts_with(':') {
continue;
}
let Some(data) = super::extract_sse_data_value(&line) else {
continue;
};
if data == "[DONE]" {
break;
}
let value: Value = match serde_json::from_str(data) {
Ok(value) => value,
Err(err) => {
yield Err(anyhow::anyhow!(
"Antigravity cloud-code SSE is not JSON: {err}"
));
return;
}
};
if let Some(error) = value.get("error") {
yield Ok(StreamEvent::Error {
error: error.clone(),
});
return;
}
let Some(text) = extract_cloud_code_text(&value) else {
if value.get("response").is_some() || value.get("candidates").is_some() {
continue;
}
yield Err(anyhow::anyhow!(
"Antigravity cloud-code SSE shape is unproven; failing closed"
));View on GitHub (pinned to 8880682c63)
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
Defensive patterns
Strategy: try-catch
Type guard
fn is_cloud_code_json_error(err: &anyhow::Error) -> bool {
err.to_string().starts_with("Antigravity cloud-code SSE is not JSON")
} Try / catch
match stream.next().await {
Some(Err(e)) if is_cloud_code_json_error(&e) => {
log::warn!("bad cloud-code frame: {e}");
backoff_retry().await; // truncation is usually transient
}
Some(Err(e)) => return Err(e),
other => { /* forward */ }
} Prevention
- 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
When it happens
Trigger: A truncated or rewritten SSE payload from an intermediary; the endpoint emitting a non-JSON data line; in-transit corruption making the line unparseable.
Common situations: Proxies buffering/mangling SSE; provider serialization bug; flaky network corrupting a line.
Related errors
- invalid SSE JSON: {e}
- {err}
- Antigravity cloud-code SSE shape is unproven; failing closed
- Codewhale stream-json line {line_number} was not valid JSON
- Codewhale stream-json line {line_number} was not an object
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/ee0094e98cb63709.
Report an issue: GitHub.