zed-industries/zed · error

failed to bind callback port

Error message

failed to bind callback port

What it means

During the local keypair-based authentication handshake, the client needs to bind a local callback port so the browser sign-in flow can deliver credentials; this error means binding that ephemeral local listener port failed (port exhaustion or OS socket restrictions), aborting authentication before any server interaction.

Solutions

  1. Retry sign-in — ephemeral port bind failures are usually transient
  2. Check OS-level socket/port restrictions or security software blocking local listeners
  3. Use an alternative sign-in method (e.g. paste-token flow) if local ports are consistently blocked
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/client/src/client.rs:1471 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/c0a739161dee94e6. Report an issue: GitHub.

Appendix: source

Thrown at crates/client/src/client.rs:1471

                        rpc::auth::keypair().context("failed to generate keypair for auth")?;
                    let public_key = String::try_from(public_key)
                        .context("failed to serialize public key for auth")?;

                    if let Some((login, token)) =
                        IMPERSONATE_LOGIN.as_ref().zip(ADMIN_API_TOKEN.as_ref())
                    {
                        if !*USE_WEB_LOGIN {
                            eprintln!("authenticate as admin {login}, {token}");

                            return this
                                .authenticate_as_admin(http, login.clone(), token.clone())
                                .await;
                        }
                    }

                    // Start an HTTP server to receive the redirect from Zed's sign-in page.
                    let server = tiny_http::Server::http("127.0.0.1:0")
                        .map_err(|e| anyhow!(e).context("failed to bind callback port"))?;
                    let port = server
                        .server_addr()
                        .to_ip()
                        .context("server not bound to a TCP address")?
                        .port();

                    #[derive(Serialize)]
                    struct NativeAppSignInQueryParams {
                        native_app_port: u16,
                        native_app_public_key: String,
                        system_id: Option<Arc<str>>,
                    }

                    // Open the Zed sign-in page in the user's browser, with query parameters that indicate
                    // that the user is signing in from a Zed app running on the same device.
                    let url = http.build_url(&format!(
                        "/native_app_signin?{}",
                        serde_urlencoded::to_string(&NativeAppSignInQueryParams {

View on GitHub (pinned to f4178619ac)