zed-industries/zed · error
OAuth token is missing while updating Copilot Chat models
Error message
OAuth token is missing while updating Copilot Chat models
What it means
update_models reads the Copilot Chat entity state to obtain its OAuth token; the token was None, so the models list cannot be refreshed. It means Copilot Chat isn't authenticated (or credentials were cleared) at the time of the refresh.
Solutions
- Sign in to Copilot Chat so an OAuth token is stored
- Retry the model refresh after authentication completes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/copilot_chat/src/copilot_chat.rs:723 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20).
Data as JSON: /api/errors/b28908dade2f48f2.
Report an issue: GitHub.
Appendix: source
Thrown at crates/copilot_chat/src/copilot_chat.rs:731
self.models = None;
self.sign_in_task = None;
self.status = CopilotChatStatus::SignedOut;
cx.notify();
cx.spawn(async move |_, cx| {
credentials_provider
.delete_credentials(&credentials_url, cx)
.await
.context("deleting Copilot agent credentials from the keychain")?;
anyhow::Ok(())
})
}
async fn update_models(this: &WeakEntity<Self>, cx: &mut AsyncApp) -> Result<()> {
let (oauth_token, client, configuration) = this.read_with(cx, |this, _| {
(
this.oauth_token.clone(),
this.client.clone(),
this.configuration.clone(),
)
})?;
let oauth_token = oauth_token
.ok_or_else(|| anyhow!("OAuth token is missing while updating Copilot Chat models"))?;
let api_endpoint =
Self::resolve_api_endpoint(&this, &oauth_token, &configuration, &client, cx).await?;
let models_url = configuration.models_url(&api_endpoint);
let models = get_models(models_url.into(), oauth_token, client.clone()).await?;
this.update(cx, |this, cx| {
this.models = Some(models);
cx.notify();
})?;
anyhow::Ok(())View on GitHub (pinned to 916fc2b8cb)