{"record":{"id":"428507b4b3bca434","repo":"Hmbown/CodeWhale","slug":"antigravity-cloud-code-http-status-redacted","errorCode":null,"errorMessage":"Antigravity cloud-code HTTP {status}: {redacted}","messagePattern":"Antigravity cloud-code HTTP (.+?): (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/client/cloud_code.rs","lineNumber":162,"sourceCode":"        })\n        .await;\n        let response = match opened {\n            Ok(response) => response,\n            Err(err) => {\n                self.mark_request_failure(&format!(\"cloud-code stream open: {err}\"))\n                    .await;\n                return Err(err);\n            }\n        };\n        if !response.status().is_success() {\n            let status = response.status();\n            let body = response.text().await.unwrap_or_default();\n            let redacted = crate::llm_client::sanitize_http_error_body(\n                Some(\"antigravity\"),\n                status.as_u16(),\n                &body,\n            );\n            bail!(\"Antigravity cloud-code HTTP {status}: {redacted}\");\n        }\n\n        let stream_idle_timeout = self.stream_idle_timeout;\n        let byte_stream = response.bytes_stream();\n        let stream = async_stream::stream! {\n            let mut buffer: Vec<u8> = Vec::new();\n            let stream_start = std::time::Instant::now();\n            let mut last_chunk_at = std::time::Instant::now();\n            let mut bytes_received: usize = 0;\n            let mut started = false;\n            tokio::pin!(byte_stream);\n\n            loop {\n                let chunk = match tokio::time::timeout(stream_idle_timeout, byte_stream.next()).await {\n                    Ok(Some(Ok(chunk))) => chunk,\n                    Ok(Some(Err(e))) => {\n                        yield Err(anyhow::anyhow!(\"Stream read error: {e}\"));\n                        return;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/client/cloud_code.rs#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"OAuth token for antigravity expiring between sessions; quota consumed by heavy streaming use; endpoint outages or regional restrictions.","solutions":["Check the status: 401/403 means re-authenticate the antigravity provider (devkey/auth flow)","429: stop, wait, and retry later; reduce streaming concurrency","Inspect the redacted body for the service's own reason string","5xx: transient — retry after a pause or fall back to another provider"],"exampleFix":"// before: session started with an expired token\n// -> Antigravity cloud-code HTTP 401: ...\n\n// after: re-auth, then start a new session\n// devkey run antigravity-auth -- codewhale  (refresh credentials)\nlet client = Client::from_config(&config).await?;","handlingStrategy":"retry","validationCode":"// Before a long session, cheap auth precheck on the antigravity route\nlet probe = client.cloud_code_probe().await;\nanyhow::ensure!(probe.map_or(true, |s| s != 401 && s != 403), \"antigravity credentials need refresh\");","typeGuard":"fn cloud_code_error_needs_reauth(err: &anyhow::Error) -> bool {\n    let m = err.to_string();\n    m.contains(\"HTTP 401\") || m.contains(\"HTTP 403\")\n}","tryCatchPattern":"match open_cloud_code_stream(&client, &body).await {\n    Ok(s) => Ok(s),\n    Err(err) if cloud_code_error_needs_reauth(&err) => {\n        refresh_antigravity_credentials().await?; // then retry once\n        open_cloud_code_stream(&client, &body).await\n    }\n    Err(err) if err.to_string().contains(\"HTTP 429\") || err.to_string().contains(\"HTTP 5\") => {\n        backoff_and_retry(err).await\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Refresh antigravity credentials when sessions are long-lived rather than per request","Keep the redacted body in logs — it carries the service's own reason","Budget for 429s: cloud-code streams count against quota quickly"],"tags":["antigravity","cloud-code","http-status","auth","quota","rust"],"backgroundTag":"antigravity-api-error","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}