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

  1. Retry the request — truncation is usually transient
  2. Capture the raw data line to see whether it is truncated JSON or non-JSON content
  3. Bypass intermediaries; verify the endpoint
  4. 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

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


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/ee0094e98cb63709. Report an issue: GitHub.