Hmbown/CodeWhale · error · anyhow::Error

Antigravity cloud-code HTTP {status}: {redacted}

Error message

Antigravity cloud-code HTTP {status}: {redacted}

What it means

The cloud-code HTTP response returned a non-success status. The body is read in full and passed through `sanitize_http_error_body` labeled "antigravity" so sensitive material is redacted, then the status and redacted body are bailed together. This occurs after transport-level retries and error injection handling have already run, so it represents a definitive rejection by the Antigravity endpoint.

Source

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

        })
        .await;
        let response = match opened {
            Ok(response) => response,
            Err(err) => {
                self.mark_request_failure(&format!("cloud-code stream open: {err}"))
                    .await;
                return Err(err);
            }
        };
        if !response.status().is_success() {
            let status = response.status();
            let body = response.text().await.unwrap_or_default();
            let redacted = crate::llm_client::sanitize_http_error_body(
                Some("antigravity"),
                status.as_u16(),
                &body,
            );
            bail!("Antigravity cloud-code HTTP {status}: {redacted}");
        }

        let stream_idle_timeout = self.stream_idle_timeout;
        let byte_stream = response.bytes_stream();
        let stream = async_stream::stream! {
            let mut buffer: Vec<u8> = Vec::new();
            let stream_start = std::time::Instant::now();
            let mut last_chunk_at = std::time::Instant::now();
            let mut bytes_received: usize = 0;
            let mut started = false;
            tokio::pin!(byte_stream);

            loop {
                let chunk = match tokio::time::timeout(stream_idle_timeout, byte_stream.next()).await {
                    Ok(Some(Ok(chunk))) => chunk,
                    Ok(Some(Err(e))) => {
                        yield Err(anyhow::anyhow!("Stream read error: {e}"));
                        return;

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Check the status: 401/403 means re-authenticate the antigravity provider (devkey/auth flow)
  2. 429: stop, wait, and retry later; reduce streaming concurrency
  3. Inspect the redacted body for the service's own reason string
  4. 5xx: transient — retry after a pause or fall back to another provider

Example fix

// before: session started with an expired token
// -> Antigravity cloud-code HTTP 401: ...

// after: re-auth, then start a new session
// devkey run antigravity-auth -- codewhale  (refresh credentials)
let client = Client::from_config(&config).await?;
Defensive patterns

Strategy: retry

Validate before calling

// Before a long session, cheap auth precheck on the antigravity route
let probe = client.cloud_code_probe().await;
anyhow::ensure!(probe.map_or(true, |s| s != 401 && s != 403), "antigravity credentials need refresh");

Type guard

fn cloud_code_error_needs_reauth(err: &anyhow::Error) -> bool {
    let m = err.to_string();
    m.contains("HTTP 401") || m.contains("HTTP 403")
}

Try / catch

match open_cloud_code_stream(&client, &body).await {
    Ok(s) => Ok(s),
    Err(err) if cloud_code_error_needs_reauth(&err) => {
        refresh_antigravity_credentials().await?; // then retry once
        open_cloud_code_stream(&client, &body).await
    }
    Err(err) if err.to_string().contains("HTTP 429") || err.to_string().contains("HTTP 5") => {
        backoff_and_retry(err).await
    }
    Err(err) => Err(err),
}

Prevention

When it happens

Trigger: 401 from expired or invalid Antigravity/Google cloud credentials, 403 for lack of entitlement, 429 quota exhaustion, 5xx service errors from the cloud-code endpoint.

Common situations: OAuth token for antigravity expiring between sessions; quota consumed by heavy streaming use; endpoint outages or regional restrictions.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/428507b4b3bca434. Report an issue: GitHub.