jdx/mise · error
GitHub API URL should support path segments
Error message
GitHub API URL should support path segments
What it means
This panic fires when `path_segments_mut()` returns Err, which happens only for 'cannot-be-a-base' URLs (URLs without hierarchical paths, e.g. `mailto:`). The GitHub API URL is a normal hierarchical https URL, so this is an internal invariant assertion that path manipulation is legal.
Source
Thrown at src/backend/aqua.rs:2304
)
})?;
Ok((
asset.browser_download_url.to_string(),
Some(asset.url.to_string()),
asset.digest.clone(),
))
}
fn github_archive_url(&self, pkg: &AquaPackage, v: &str) -> String {
let gh_id = format!("{}/{}", pkg.repo_owner, pkg.repo_name);
format!("https://github.com/{gh_id}/archive/refs/tags/{v}.tar.gz")
}
fn github_archive_api_url(&self, pkg: &AquaPackage, v: &str) -> String {
let mut url = Url::parse(github::API_URL).expect("GitHub API URL should be valid");
url.path_segments_mut()
.expect("GitHub API URL should support path segments")
.extend([
"repos",
pkg.repo_owner.as_str(),
pkg.repo_name.as_str(),
"tarball",
v,
]);
url.to_string()
}
fn github_content_url(&self, pkg: &AquaPackage, v: &str) -> String {
let gh_id = format!("{}/{}", pkg.repo_owner, pkg.repo_name);
let path = pkg.path.as_deref().unwrap();
format!("https://raw.githubusercontent.com/{gh_id}/{v}/{path}")
}
fn github_content_api_url(&self, pkg: &AquaPackage, v: &str) -> String {
let mut url = Url::parse(github::API_URL).expect("GitHub API URL should be valid");View on GitHub (pinned to afd2eddd3a)
Solutions
- Ensure `github::API_URL` remains a hierarchical https URL
- Use the latest released mise; file a bug with a backtrace if it fires on a stock build
Defensive patterns
Strategy: type-guard
Validate before calling
let u = url::Url::parse(github::API_URL).unwrap(); assert!(u.path_segments_mut().is_ok(), "API URL must be hierarchical (cannot-be-a-base URLs unsupported)");
Type guard
fn supports_path_segments(u: &url::Url) -> bool { u.path_segments_mut().is_ok() } Try / catch
if let Ok(mut segs) = url.path_segments_mut() { segs.extend(["repos", owner, name, "tarball", v]); } else { eprintln!("non-hierarchical API URL"); } Prevention
- Keep the API base URL hierarchical (https scheme with host)
- Unit-test that path_segments_mut() succeeds for the API constant
When it happens
Trigger: Calling `github_archive_api_url` on an aqua package while the base `github::API_URL` is a cannot-be-a-base URL — only possible if the constant was replaced with a non-hierarchical scheme.
Common situations: Effectively unreachable; appears only during development when someone changes the API base URL constant to an opaque scheme or misapplies a patch.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- GitHub API URL should be valid
- task executor initialized
- executor must be initialized before running tasks
- executor must be initialized before displaying cache stats
- generated mise usage spec
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/815876ac00701d73.
Report an issue: GitHub.