Hmbown/CodeWhale · error

{err}

Error message

{err}

What it means

On the Antigravity cloud-code route, a complete SSE line failed strict UTF-8 decode in `take_sse_line` (`InvalidSseUtf8` carrying valid_up_to/error_len). Consistent with the #5374 fail-closed policy, invalid bytes abort the stream instead of being replaced with U+FFFD.

Source

Thrown at crates/tui/src/client/cloud_code.rs:202

                        yield Err(anyhow::anyhow!(stream_entry::idle_timeout_message(
                            stream_idle_timeout,
                            bytes_received,
                            stream_start.elapsed(),
                            last_chunk_at.elapsed(),
                        )));
                        return;
                    }
                };
                bytes_received += chunk.len();
                last_chunk_at = std::time::Instant::now();
                buffer.extend_from_slice(&chunk);

                loop {
                    let line = match super::take_sse_line(&mut buffer) {
                        Ok(Some(line)) => line,
                        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}"
                            ));

View on GitHub (pinned to 8880682c63)

Solutions

  1. Retry once — transient corruption usually clears
  2. Bypass proxies between client and the cloud-code endpoint
  3. If deterministic, capture raw bytes and report upstream
Defensive patterns

Strategy: try-catch

Type guard

fn is_invalid_sse_utf8(err: &anyhow::Error) -> bool {
    err.to_string().contains("SSE line is not valid UTF-8")
}

Try / catch

match stream.next().await {
    Some(Err(e)) if is_invalid_sse_utf8(&e) => {
        backoff_retry().await; // corruption is usually transient
    }
    Some(Err(e)) => return Err(e),
    other => { /* forward */ }
}

Prevention

When it happens

Trigger: Corrupt bytes delivered by a proxy/CDN; a non-UTF-8 body on the endpoint; intermediary rewriting the stream.

Common situations: MITM transcoding; provider emitting a mis-encoded frame; corrupted transfer.

Related errors


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