{"record":{"id":"c7cf1c7a53121940","repo":"jdx/mise","slug":"invalid-github-tap-url-url","errorCode":null,"errorMessage":"invalid GitHub tap URL '{url}'","messagePattern":"invalid GitHub tap URL '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/tap.rs","lineNumber":248,"sourceCode":"\nfn github_repository<'a>(\n    owner: &'a str,\n    tap: &'a str,\n    tap_url: Option<&'a str>,\n) -> Result<(&'a str, String)> {\n    let Some(url) = tap_url else {\n        return Ok((owner, format!(\"homebrew-{tap}\")));\n    };\n    let normalized = url.trim_end_matches('/').trim_end_matches(\".git\");\n    let rest = normalized\n        .strip_prefix(\"https://github.com/\")\n        .ok_or_else(|| eyre::eyre!(\"only GitHub tap URLs can be fetched directly\"))?;\n    let mut parts = rest.split('/');\n    match (parts.next(), parts.next(), parts.next()) {\n        (Some(repo_owner), Some(repo), None) if !repo_owner.is_empty() && !repo.is_empty() => {\n            Ok((repo_owner, repo.to_string()))\n        }\n        _ => bail!(\"invalid GitHub tap URL '{url}'\"),\n    }\n}\n\nasync fn fetch_formula_source(tap_source: &TapSource, name: &str) -> Result<(String, String)> {\n    let root_tree: GithubTree = HTTP_FETCH\n        .json_cached(format!(\n            \"{}/git/trees/{}\",\n            tap_source.api_base, tap_source.commit\n        ))\n        .await\n        .wrap_err(\"failed to inspect tap formula directories\")?;\n    if root_tree.truncated {\n        bail!(\"tap repository tree was truncated\");\n    }\n\n    let (directory, formula_tree) =\n        if let Some((directory, sha)) = active_formula_directory(&root_tree) {\n            let tree: GithubTree = HTTP_FETCH","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/tap.rs#L230-L266","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use a plain GitHub repository URL of the form https://github.com/<owner>/<repo>","Remove extra path segments such as /tree/<branch> or trailing slashes","Install GitLab/non-GitHub taps via `brew tap` itself instead of direct URL fetching"],"exampleFix":"// before\nurl = \"https://github.com/owner/repo/tree/main\"\n// after\nurl = \"https://github.com/owner/repo\"","handlingStrategy":"validation","validationCode":"fn is_github_tap_url(url: &str) -> bool {\n    let rest = url.strip_prefix(\"https://github.com/\").unwrap_or(url.strip_prefix(\"http://github.com/\").unwrap_or(\"\"));\n    let mut parts = rest.split('/');\n    matches!((parts.next(), parts.next(), parts.next()),\n        (Some(o), Some(r), None) if !o.is_empty() && !r.is_empty())\n}","typeGuard":"fn parse_github_tap(url: &str) -> Option<(String, String)> {\n    let rest = url.strip_prefix(\"https://github.com/\")?;\n    let (owner, repo) = rest.split_once('/')?;\n    (!owner.is_empty() && !repo.is_empty() && !repo.contains('/'))\n        .then(|| (owner.to_string(), repo.to_string()))\n}","tryCatchPattern":null,"preventionTips":["Store tap URLs as plain https://github.com/<owner>/<repo> without /tree/... suffixes","Only use URL-based taps for GitHub-hosted taps; use `brew tap` for others"],"tags":["brew","url","github"],"backgroundTag":"invalid-url-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}