zed-industries/zed · error

missing 'code' parameter in OAuth callback

Error message

missing 'code' parameter in OAuth callback

What it means

Parse guard in OAuthCallbackParams::parse_query: the provider's redirect to the callback URL contained no `code` query parameter (and no error parameters either), so an authorization code cannot be extracted and sign-in cannot complete.

Source

Thrown at crates/oauth_callback_server/src/oauth_callback_server.rs:213

                    }
                    "error_description" => {
                        if !value.is_empty() {
                            error_description = Some(value.into_owned());
                        }
                    }
                    _ => {}
                }
            }

            if let Some(error_code) = error {
                anyhow::bail!(
                    "OAuth authorization failed: {} ({})",
                    error_code,
                    error_description.as_deref().unwrap_or("no description")
                );
            }

            let code = code.ok_or_else(|| anyhow!("missing 'code' parameter in OAuth callback"))?;
            let state =
                state.ok_or_else(|| anyhow!("missing 'state' parameter in OAuth callback"))?;

            Ok(Self { code, state })
        }
    }

    /// How long to wait for the browser to complete the OAuth flow before giving
    /// up and releasing the loopback port.
    const OAUTH_CALLBACK_TIMEOUT: Duration = Duration::from_secs(2 * 60);

    /// Start a loopback HTTP server to receive the OAuth authorization callback.
    ///
    /// Binds to an ephemeral loopback port. Returns `(redirect_uri, callback_future)`.
    /// The caller should use the redirect URI in the authorization request, open
    /// the browser, then await the future to receive the callback.
    pub fn start_oauth_callback_server() -> Result<(
        String,

View on GitHub (pinned to f4178619ac)

Solutions

  1. Retry the OAuth sign-in flow from the beginning
  2. Check the provider's redirect configuration includes the authorization code response type
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oauth_callback_server/src/oauth_callback_server.rs:213 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/68eab410085bbbe6. Report an issue: GitHub.