{"record":{"id":"f6378d08feb85707","repo":"zed-industries/zed","slug":"oauth-callback-server-was-shut-down-before-receivi","errorCode":null,"errorMessage":"OAuth callback server was shut down before receiving a response","messagePattern":"OAuth callback server was shut down before receiving a response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/context_server/src/oauth.rs","lineNumber":1103,"sourceCode":"/// redirect URI in the authorization request, open the browser, then await\n/// the future to receive the callback.\n///\n/// The server accepts exactly one request on `/callback`, validates that it\n/// contains `code` and `state` query parameters, responds with a minimal\n/// HTML page telling the user they can close the tab, and shuts down.\n///\n/// The callback server shuts down when the returned future is dropped (e.g.\n/// because the authentication task was cancelled), or after a timeout.\npub fn start_callback_server() -> Result<(String, BoxFuture<'static, Result<OAuthCallback>>)> {\n    let (redirect_uri, rx) = oauth_callback_server::start_oauth_callback_server()?;\n    let future = async move {\n        match rx.await {\n            Ok(Ok(params)) => Ok(OAuthCallback {\n                code: params.code,\n                state: params.state,\n            }),\n            Ok(Err(e)) => Err(e),\n            Err(_) => Err(anyhow!(\n                \"OAuth callback server was shut down before receiving a response\"\n            )),\n        }\n    }\n    .boxed();\n    Ok((redirect_uri, future))\n}\n\n// -- JSON fetch helper -------------------------------------------------------\n\nasync fn fetch_json<T: serde::de::DeserializeOwned>(\n    http_client: &Arc<dyn HttpClient>,\n    url: &Url,\n) -> Result<T> {\n    validate_oauth_url(url)?;\n\n    let request = Request::builder()\n        .method(http_client::http::Method::GET)","sourceCodeStart":1085,"sourceCodeEnd":1121,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/context_server/src/oauth.rs#L1085-L1121","documentation":"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.","triggerScenarios":"Thrown at crates/context_server/src/oauth.rs:1103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry sign-in and complete the browser flow before the callback timeout","Ensure nothing blocks localhost callback requests (firewall, browser settings)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}