windmill-labs/windmill · error

Invalid Slack authorization URL: {e}

Error message

Invalid Slack authorization URL: {e}

What it means

build_slack_client hardcodes the Slack authorization endpoint https://slack.com/oauth/v2/authorize and parses it with Url::parse. Since the literal is a valid URL, this error is practically unreachable and only fires if the constant is edited or a build-time transformation corrupts it.

Source

Thrown at backend/windmill-oauth/src/lib.rs:365

    if config.req_body_auth.unwrap_or(false) {
        client.set_auth_type(AuthType::RequestBody);
    }
    client.set_client_secret(client_params.secret.clone());
    client.set_redirect_url(
        Url::parse(&redirect_url).map_err(|e| anyhow!("Invalid redirect URL: {e}"))?,
    );

    Ok((name.to_string(), client))
}

/// Build a Slack OAuth client with custom credentials
pub async fn build_slack_client(
    client_id: &str,
    client_secret: &str,
    _workspace_id: &str,
) -> error::Result<OClient> {
    let auth_url = Url::parse("https://slack.com/oauth/v2/authorize")
        .map_err(|e| anyhow!("Invalid Slack authorization URL: {e}"))?;
    let token_url = Url::parse("https://slack.com/api/oauth.v2.access")
        .map_err(|e| anyhow!("Invalid Slack token URL: {e}"))?;

    let base_url = (**BASE_URL.load()).clone();
    let redirect_url = format!("{}/oauth/callback_slack", base_url);

    let mut client = OClient::new(client_id.to_string(), auth_url, token_url);
    client.set_client_secret(client_secret.to_string());
    client.set_redirect_url(
        Url::parse(&redirect_url).map_err(|e| anyhow!("Invalid redirect URL: {e}"))?,
    );

    Ok(client)
}

/// Build OAuth client for client credentials flow with resource-level credentials.
///
/// No instance-level entry is required: the provider endpoint config resolves

View on GitHub (pinned to e474e8803c)

Solutions

  1. Restore the hardcoded URL to the exact literal https://slack.com/oauth/v2/authorize
  2. If seen in a fork, diff windmill-oauth/src/lib.rs against upstream to find the corrupted constant
Defensive patterns

Strategy: try-catch

Try / catch

match build_slack_client(id, secret, workspace_id).await {
    Ok(c) => c,
    Err(e) if e.to_string().contains("Invalid Slack authorization URL") => unreachable!("hardcoded URL corrupted"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Only from a modified/patched source where the hardcoded Slack authorize URL literal was changed to an unparseable value; normal operation of build_slack_client cannot trigger it.

Common situations: Internal forks or codegen patches altering hardcoded URLs; essentially never seen in production.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/1925a6de9367cdb4. Report an issue: GitHub.