zed-industries/zed · error · anyhow::Error

didn't receive login redirect

Error message

didn't receive login redirect

What it means

During browser sign-in, Zed starts a local HTTP server on 127.0.0.1, opens the Zed sign-in page with the port and a public key, and waits for the browser to redirect back with `user_id` and an encrypted `access_token`. The loop polls `server.recv_timeout(1s)` exactly 100 times (~100 seconds); if no redirect request ever arrives, it gives up with this error.

Solutions

  1. Retry the sign-in and complete it promptly in the browser tab that opens — 100 seconds is the budget.
  2. If no browser opened, copy the sign-in URL manually into a browser on the same machine.
  3. Temporarily disable extensions/proxy rules that block or rewrite localhost redirects, and allow loopback connections in firewall settings.
  4. On headless machines, sign in elsewhere and configure credentials via the supported environment/sign-in alternative instead of the browser flow.
Defensive patterns

Strategy: retry

Try / catch

match client.sign_in_with_browser(cx).await {
    Err(err) if err.to_string().contains("didn't receive login redirect") => {
        // user likely never completed sign-in in time; safe to retry
        client.sign_in_with_browser(cx).await
    }
    result => result,
}

Prevention

When it happens

Trigger: The sign-in page never redirects to `http://127.0.0.1:<port>/...`: browser failed to open (headless/SSH session without a browser), the user closed the tab before completing sign-in, browser/extension blocked the localhost redirect, OS firewall blocked loopback listening, or clock/token expiry on the server side aborted the flow.

Common situations: Signing in over remote desktop/SSH/X-forwarding where `open_url` can't reach a browser; corporate proxies or privacy extensions stripping redirects to localhost; slow sign-in (MFA prompts) exceeding ~100s; firewall rules blocking binding or connecting on 127.0.0.1.

Related errors


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/0fce484cdf9fceca. Report an issue: GitHub.

Appendix: source

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

                                        http.build_url("/native_app_signin_succeeded");
                                    req.respond(
                                        tiny_http::Response::empty(302).with_header(
                                            tiny_http::Header::from_bytes(
                                                &b"Location"[..],
                                                post_auth_url.as_bytes(),
                                            )
                                            .unwrap(),
                                        ),
                                    )
                                    .context("failed to respond to login http request")?;
                                    return Ok((
                                        callback_params.user_id,
                                        callback_params.access_token,
                                    ));
                                }
                            }

                            anyhow::bail!("didn't receive login redirect");
                        })
                        .await?;

                    let access_token = private_key
                        .decrypt_string(&access_token)
                        .context("failed to decrypt access token")?;

                    Ok(Credentials {
                        user_id: user_id.parse()?,
                        access_token,
                    })
                })
                .await?;

            cx.update(|cx| cx.activate(true));
            Ok(credentials)
        })
    }

View on GitHub (pinned to f4178619ac)