{"record":{"id":"f496b61851f3d441","repo":"Hmbown/CodeWhale","slug":"codewhale-account-request-failed-http-status","errorCode":null,"errorMessage":"Codewhale account request failed (HTTP {status})","messagePattern":"Codewhale account request failed \\(HTTP (.+?)\\)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/cloud.rs","lineNumber":1300,"sourceCode":"fn response_error(response: &CloudResponse) -> anyhow::Error {\n    let code = serde_json::from_slice::<serde_json::Value>(&response.body)\n        .ok()\n        .and_then(|body| {\n            body.get(\"code\")\n                .and_then(serde_json::Value::as_str)\n                .or_else(|| {\n                    body.get(\"error\")\n                        .and_then(|error| error.get(\"code\"))\n                        .and_then(serde_json::Value::as_str)\n                })\n                .and_then(safe_error_code)\n        });\n    match code {\n        Some(code) => anyhow!(\n            \"Codewhale account request failed (HTTP {}, code {code})\",\n            response.status\n        ),\n        None => anyhow!(\n            \"Codewhale account request failed (HTTP {})\",\n            response.status\n        ),\n    }\n}\n\nfn safe_error_code(code: &str) -> Option<String> {\n    if code.is_empty()\n        || code.len() > 80\n        || !code\n            .bytes()\n            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'_' | b'-' | b'.'))\n    {\n        return None;\n    }\n    Some(code.to_string())\n}\n","sourceCodeStart":1282,"sourceCodeEnd":1318,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/cloud.rs#L1282-L1318","documentation":"Sibling of the coded variant: when the Codewhale account API returns a non-success HTTP status but the body has no usable `code` field, the CLI raises this error with just the HTTP status. It is the fallback branch of the same match as error 1532.","triggerScenarios":"Any account API request returning a non-success status whose error body is non-JSON, JSON without a `code` key, or whose code failed the `safe_error_code` filter (non-string/unsafe characters).","commonSituations":"HTML error pages from proxies/load balancers (502/503), empty error bodies, CDN intercepting the request, service incidents returning bare statuses.","solutions":["Check the HTTP status: 401/403 → re-authenticate with `codewhale login` or a fresh API key.","For 5xx, retry later or check service status; a proxy/CDN is likely stripping the error body.","Inspect connectivity: corporate proxies or VPNs may intercept account API traffic."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// bare-status errors are often 5xx from proxies\nmatch result {\n    Err(e) if e.to_string().contains(\"Codewhale account request failed (HTTP 5\")\n        => backoff_retry(|| send_request(), 3),\n    other => other,\n}","preventionTips":["Retry 5xx with backoff; fail fast on 4xx.","Re-authenticate on 401/403 before retrying.","Monitor proxy/CDN interference on account API traffic."],"tags":["http","api","cloud"],"backgroundTag":"http-error-response","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T10:30:35.592Z"}