zeroclaw-labs/zeroclaw · error · anyhow::Error
loadCodeAssist failed (HTTP {status}): {body}
Error message
loadCodeAssist failed (HTTP {status}): {body} What it means
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.
Source
Thrown at crates/zeroclaw-providers/src/gemini.rs:968
}
}))
.send()
.await?;
if !response.status().is_success() {
let status = response.status();
let body = response.text().await.unwrap_or_default();
if let Some(seed) = project_seed {
::zeroclaw_log::record!(
WARN,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note)
.with_outcome(::zeroclaw_log::EventOutcome::Unknown)
.with_attrs(::serde_json::json!({"status": status.to_string()})),
"loadCodeAssist failed (HTTP ); using oauth_project seed fallback"
);
return Ok(seed);
}
anyhow::bail!("loadCodeAssist failed (HTTP {status}): {body}");
}
let result: LoadCodeAssistResponse = response.json().await?;
let project = result
.resolve_project_id()
.or(project_seed)
.ok_or_else(|| {
::zeroclaw_log::record!(
ERROR,
::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)
.with_outcome(::zeroclaw_log::EventOutcome::Failure)
.with_attrs(::serde_json::json!({
"missing": "cloudaicompanionProject",
})),
"gemini: loadCodeAssist missing project context"
);
anyhow::Error::msg("loadCodeAssist response missing project context")
})?;View on GitHub (pinned to 88bb9c8533)
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
Example fix
# before [model_provider.gcli] family = "gemini_cli" # after [model_provider.gcli] family = "gemini_cli" oauth_project = "my-gcp-project-id"
Defensive patterns
Strategy: fallback
Validate before calling
// Seed the project so loadCodeAssist is never load-bearing
if alias.family == "gemini_cli" && alias.oauth_project.is_none() {
// prefer failing at config validation time with a clear hint
warn!("set oauth_project so project resolution cannot fail mid-request");
} Try / catch
match provider.chat(/* ... */).await {
Ok(resp) => Ok(resp),
Err(e) if e.to_string().contains("loadCodeAssist failed") => {
// transient 5xx: retry once; 401/403/404: credential/onboarding gap,
// seed oauth_project in config and complete `gemini` onboarding
Err(e)
}
Err(e) => Err(e),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Google device code request failed ({}): {}
- Device code expired before authorization was completed
- User denied authorization
- Device code expired
- OAuth state mismatch
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/79b79531237f5249.
Report an issue: GitHub.