windmill-labs/windmill · error

Invalid Slack token URL: {e}

Error message

Invalid Slack token URL: {e}

What it means

Companion check in build_slack_client for the hardcoded Slack token endpoint https://slack.com/api/oauth.v2.access. Like the authorize-URL error, the literal is valid, so the error is effectively unreachable unless the source constant was altered.

Source

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

    }
    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
/// from the instance `oauths` entry when one exists, else from the static
/// registry, else is synthesized from the token URL override alone. Returns the

View on GitHub (pinned to e474e8803c)

Solutions

  1. Restore the literal https://slack.com/api/oauth.v2.access in windmill-oauth/src/lib.rs
  2. Rebuild the backend after reverting the 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 token URL") => unreachable!("hardcoded URL corrupted"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Only when the hardcoded token URL literal in build_slack_client has been modified to something Url::parse rejects.

Common situations: Fork/patch drift; not triggered by user configuration since Slack endpoints are not configurable here.

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/66b6e0dee28e9fee. Report an issue: GitHub.