zed-industries/zed · error
OAuth callback server was shut down before receiving a…
Error message
OAuth callback server was shut down before receiving a response
What it means
The OAuth callback future ended (the one-shot callback server shut down due to timeout or task cancellation) before a callback request carrying code and state arrived. The browser redirect never reached the local listener, so authentication cannot complete.
Solutions
- Retry sign-in and complete the browser flow before the callback timeout
- Ensure nothing blocks localhost callback requests (firewall, browser settings)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/context_server/src/oauth.rs:1103 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/f6378d08feb85707.
Report an issue: GitHub.
Appendix: source
Thrown at crates/context_server/src/oauth.rs:1103
/// redirect URI in the authorization request, open the browser, then await
/// the future to receive the callback.
///
/// The server accepts exactly one request on `/callback`, validates that it
/// contains `code` and `state` query parameters, responds with a minimal
/// HTML page telling the user they can close the tab, and shuts down.
///
/// The callback server shuts down when the returned future is dropped (e.g.
/// because the authentication task was cancelled), or after a timeout.
pub fn start_callback_server() -> Result<(String, BoxFuture<'static, Result<OAuthCallback>>)> {
let (redirect_uri, rx) = oauth_callback_server::start_oauth_callback_server()?;
let future = async move {
match rx.await {
Ok(Ok(params)) => Ok(OAuthCallback {
code: params.code,
state: params.state,
}),
Ok(Err(e)) => Err(e),
Err(_) => Err(anyhow!(
"OAuth callback server was shut down before receiving a response"
)),
}
}
.boxed();
Ok((redirect_uri, future))
}
// -- JSON fetch helper -------------------------------------------------------
async fn fetch_json<T: serde::de::DeserializeOwned>(
http_client: &Arc<dyn HttpClient>,
url: &Url,
) -> Result<T> {
validate_oauth_url(url)?;
let request = Request::builder()
.method(http_client::http::Method::GET)View on GitHub (pinned to f4178619ac)