zed-industries/zed · error · anyhow::Error
OAuth callback was cancelled
Error message
OAuth callback was cancelled
What it means
The one-shot channel carrying the OAuth callback result was dropped before a callback arrived — the local HTTP listener or the awaiting task was cancelled (e.g. the flow was aborted, the app shut down, or the listener socket closed) so the receiver got None.
Source
Thrown at crates/openai_subscribed/src/openai_subscribed.rs:1166
let mut auth_url = url::Url::parse(OPENAI_AUTHORIZE_URL).expect("valid base URL");
auth_url
.query_pairs_mut()
.append_pair("client_id", CLIENT_ID)
.append_pair("redirect_uri", &redirect_uri)
// Deliberately excludes `api.connectors.read api.connectors.invoke`
// (which Codex CLI requests): extra scopes inflate the
// access-token JWT, and the serialized credentials must fit within
// Windows Credential Manager's 2560-byte blob limit
// (CRED_MAX_CREDENTIAL_BLOB_SIZE). See #58541.
.append_pair("scope", "openid profile email offline_access")
.append_pair("response_type", "code")
.append_pair("code_challenge", &challenge)
.append_pair("code_challenge_method", "S256")
.append_pair("id_token_add_organizations", "true")
.append_pair("state", &oauth_state)
.append_pair("codex_cli_simplified_flow", "true")
.append_pair("originator", "zed");
// Open browser AFTER the listener is ready
cx.update(|cx| cx.open_url(auth_url.as_str()));
// Await the callback
let callback = callback_rx
.await
.map_err(|_| anyhow!("OAuth callback was cancelled"))?
.context("OAuth callback failed")?;
// Validate CSRF state
if callback.state != oauth_state {
return Err(anyhow!("OAuth state mismatch"));
}
let tokens = exchange_code(&http_client, &callback.code, &verifier, &redirect_uri)
.await
.context("Token exchange failed")?;
View on GitHub (pinned to 5a9b9558db)
Solutions
- Restart the sign-in flow to spawn a fresh callback listener
- Check that another process or a previous sign-in attempt is not occupying the loopback redirect port
- Ensure browsers can reach the localhost redirect URI (no over-aggressive privacy/proxy tooling)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/openai_subscribed/src/openai_subscribed.rs:1134 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/0536c9771519fe66.
Report an issue: GitHub.