jdx/mise · error

invalid GitHub tap URL

Error message

invalid GitHub tap URL '{url}'

What it means

Tap sources given as URLs must be GitHub tap URLs of the exact form <api-base>/<owner>/<repo> with exactly two non-empty path segments. github_repository parses the URL and bails when the shape does not match a GitHub owner/repo pair, because direct fetching only supports GitHub-hosted taps.

Solutions

  1. Use a plain GitHub repository URL of the form https://github.com/<owner>/<repo>
  2. Remove extra path segments such as /tree/<branch> or trailing slashes
  3. Install GitLab/non-GitHub taps via `brew tap` itself instead of direct URL fetching

Example fix

// before
url = "https://github.com/owner/repo/tree/main"
// after
url = "https://github.com/owner/repo"
Defensive patterns

Strategy: validation

Validate before calling

fn is_github_tap_url(url: &str) -> bool {
    let rest = url.strip_prefix("https://github.com/").unwrap_or(url.strip_prefix("http://github.com/").unwrap_or(""));
    let mut parts = rest.split('/');
    matches!((parts.next(), parts.next(), parts.next()),
        (Some(o), Some(r), None) if !o.is_empty() && !r.is_empty())
}

Type guard

fn parse_github_tap(url: &str) -> Option<(String, String)> {
    let rest = url.strip_prefix("https://github.com/")?;
    let (owner, repo) = rest.split_once('/')?;
    (!owner.is_empty() && !repo.is_empty() && !repo.contains('/'))
        .then(|| (owner.to_string(), repo.to_string()))
}

Prevention

When it happens

Trigger: resolve_tap_source receives a tap_url that is not a GitHub URL (no GitHub host prefix), or the remainder does not split into exactly owner/repo — e.g. nested paths, trailing segments, or empty owner/repo.

Common situations: Pointing tap_url at a GitLab tap, a raw file URL, a URL with extra path components like /tree/main, or a typo'd/empty owner or repo segment.

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 jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/c7cf1c7a53121940. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/tap.rs:248

fn github_repository<'a>(
    owner: &'a str,
    tap: &'a str,
    tap_url: Option<&'a str>,
) -> Result<(&'a str, String)> {
    let Some(url) = tap_url else {
        return Ok((owner, format!("homebrew-{tap}")));
    };
    let normalized = url.trim_end_matches('/').trim_end_matches(".git");
    let rest = normalized
        .strip_prefix("https://github.com/")
        .ok_or_else(|| eyre::eyre!("only GitHub tap URLs can be fetched directly"))?;
    let mut parts = rest.split('/');
    match (parts.next(), parts.next(), parts.next()) {
        (Some(repo_owner), Some(repo), None) if !repo_owner.is_empty() && !repo.is_empty() => {
            Ok((repo_owner, repo.to_string()))
        }
        _ => bail!("invalid GitHub tap URL '{url}'"),
    }
}

async fn fetch_formula_source(tap_source: &TapSource, name: &str) -> Result<(String, String)> {
    let root_tree: GithubTree = HTTP_FETCH
        .json_cached(format!(
            "{}/git/trees/{}",
            tap_source.api_base, tap_source.commit
        ))
        .await
        .wrap_err("failed to inspect tap formula directories")?;
    if root_tree.truncated {
        bail!("tap repository tree was truncated");
    }

    let (directory, formula_tree) =
        if let Some((directory, sha)) = active_formula_directory(&root_tree) {
            let tree: GithubTree = HTTP_FETCH

View on GitHub (pinned to 533346cc37)