jdx/mise · error

invalid GitHub tap URL '{url}'

Error message

invalid GitHub tap URL '{url}'

What it means

mise can fetch tap sources directly only from GitHub URLs of the form https://github.com/<owner>/<repo>. `github_repository` parses the URL and requires exactly owner/repo segments; anything else (extra path segments, empty components, non-GitHub hosts reaching this parser) bails with this message.

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 afd2eddd3a)

Solutions

  1. Use the bare repository URL `https://github.com/<owner>/<repo>` with no extra path segments
  2. Reference the tap by short form (`owner/repo`) instead of a full URL
  3. Do not include /tree/<branch> or .git suffixes in the tap URL
  4. For non-GitHub taps, clone/locate the tap through a supported mechanism instead of direct URL fetch

Example fix

// before
mise x brew --tap "https://github.com/owner/repo/tree/main"
// after
mise x brew --tap "owner/repo"
Defensive patterns

Strategy: validation

Validate before calling

let path = url.strip_prefix("https://github.com/").ok_or("not github")?;
let segs: Vec<_> = path.split('/').filter(|s| !s.is_empty()).collect();
if segs.len() != 2 { eprintln!("use bare owner/repo GitHub URL"); }

Type guard

fn parse_github_tap(url: &str) -> Option<(String, String)> {
    let rest = url.strip_prefix("https://github.com/")?;
    let mut it = rest.split('/');
    let o = it.next()?; let r = it.next()?; let n = it.next();
    (n.is_none() && !o.is_empty() && !r.is_empty()).then(|| (o.into(), r.into()))
}

Prevention

When it happens

Trigger: `resolve_tap_source` -> `github_repository` given a URL like `https://github.com/owner/repo/tree/branch` or `https://gitlab.com/owner/repo`, i.e. more or fewer than exactly two non-empty path segments after the host.

Common situations: Typing a full tap URL with a subpath or trailing slash segments; using a GitLab/Codeberg tap URL where direct fetch expects GitHub; copy-pasting a GitHub URL that includes `/tree/<ref>` from a browser.

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