{"record":{"id":"79b79531237f5249","repo":"zeroclaw-labs/zeroclaw","slug":"loadcodeassist-failed-http-status-body","errorCode":null,"errorMessage":"loadCodeAssist failed (HTTP {status}): {body}","messagePattern":"loadCodeAssist failed \\(HTTP (.+?)\\): (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/gemini.rs","lineNumber":968,"sourceCode":"                }\n            }))\n            .send()\n            .await?;\n\n        if !response.status().is_success() {\n            let status = response.status();\n            let body = response.text().await.unwrap_or_default();\n            if let Some(seed) = project_seed {\n                ::zeroclaw_log::record!(\n                    WARN,\n                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)\n                        .with_outcome(::zeroclaw_log::EventOutcome::Unknown)\n                        .with_attrs(::serde_json::json!({\"status\": status.to_string()})),\n                    \"loadCodeAssist failed (HTTP ); using oauth_project seed fallback\"\n                );\n                return Ok(seed);\n            }\n            anyhow::bail!(\"loadCodeAssist failed (HTTP {status}): {body}\");\n        }\n\n        let result: LoadCodeAssistResponse = response.json().await?;\n        let project = result\n            .resolve_project_id()\n            .or(project_seed)\n            .ok_or_else(|| {\n                ::zeroclaw_log::record!(\n                    ERROR,\n                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                        .with_attrs(::serde_json::json!({\n                            \"missing\": \"cloudaicompanionProject\",\n                        })),\n                    \"gemini: loadCodeAssist missing project context\"\n                );\n                anyhow::Error::msg(\"loadCodeAssist response missing project context\")\n            })?;","sourceCodeStart":950,"sourceCodeEnd":986,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/gemini.rs#L950-L986","documentation":"For Gemini CLI OAuth, ZeroClaw resolves the GCP project via Google's Code Assist loadCodeAssist endpoint before calling generateContent. When that call returns non-2xx and no oauth_project seed is configured on the alias, the project cannot be determined and the request stops here with status and body.","triggerScenarios":"resolve_oauth_project POSTs to LOAD_CODE_ASSIST_ENDPOINT with the OAuth bearer token; the account has no Cloud AI Companion / Code Assist project context, the internal API answers 401/403/404, or the token lacks the required scope - and no oauth_project seed exists to fall back to.","commonSituations":"Google accounts without Gemini Code Assist access; Workspace admins disabling the Cloud AI Companion API; plain Gmail accounts with no default project attached; partially completed Gemini CLI onboarding.","solutions":["Complete onboarding in the Gemini CLI once (run `gemini`, log in, accept) so a project gets associated with the account","Set the alias oauth_project config to your GCP project id - this seeds resolve_oauth_project and removes the hard dependency on loadCodeAssist","Verify Gemini Code Assist / Cloud AI Companion is enabled for your Google Workspace account","Alternatively use an API-key-based gemini alias, which does not need project resolution"],"exampleFix":"# before\n[model_provider.gcli]\nfamily = \"gemini_cli\"\n\n# after\n[model_provider.gcli]\nfamily = \"gemini_cli\"\noauth_project = \"my-gcp-project-id\"","handlingStrategy":"fallback","validationCode":"// Seed the project so loadCodeAssist is never load-bearing\nif alias.family == \"gemini_cli\" && alias.oauth_project.is_none() {\n    // prefer failing at config validation time with a clear hint\n    warn!(\"set oauth_project so project resolution cannot fail mid-request\");\n}","typeGuard":null,"tryCatchPattern":"match provider.chat(/* ... */).await {\n    Ok(resp) => Ok(resp),\n    Err(e) if e.to_string().contains(\"loadCodeAssist failed\") => {\n        // transient 5xx: retry once; 401/403/404: credential/onboarding gap,\n        // seed oauth_project in config and complete `gemini` onboarding\n        Err(e)\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Always set oauth_project on gemini_cli aliases in production","Complete Gemini CLI onboarding once per account before headless use","Verify Code Assist / Cloud AI Companion enablement for Workspace accounts","Prefer API-key gemini aliases where project resolution is not needed"],"tags":["gemini","oauth","gcp","code-assist","rust"],"backgroundTag":"gemini-code-assist-project-error","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}