{"record":{"id":"b56ee6d24c81aa04","repo":"jdx/mise","slug":"github-api-url-should-be-valid","errorCode":null,"errorMessage":"GitHub API URL should be valid","messagePattern":"GitHub API URL should be valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/aqua.rs","lineNumber":2302,"sourceCode":"                asset_strs.iter().join(\", \"),\n                gh_release.assets.iter().map(|a| &a.name).join(\"\\n\")\n            )\n        })?;\n\n        Ok((\n            asset.browser_download_url.to_string(),\n            Some(asset.url.to_string()),\n            asset.digest.clone(),\n        ))\n    }\n\n    fn github_archive_url(&self, pkg: &AquaPackage, v: &str) -> String {\n        let gh_id = format!(\"{}/{}\", pkg.repo_owner, pkg.repo_name);\n        format!(\"https://github.com/{gh_id}/archive/refs/tags/{v}.tar.gz\")\n    }\n\n    fn github_archive_api_url(&self, pkg: &AquaPackage, v: &str) -> String {\n        let mut url = Url::parse(github::API_URL).expect(\"GitHub API URL should be valid\");\n        url.path_segments_mut()\n            .expect(\"GitHub API URL should support path segments\")\n            .extend([\n                \"repos\",\n                pkg.repo_owner.as_str(),\n                pkg.repo_name.as_str(),\n                \"tarball\",\n                v,\n            ]);\n        url.to_string()\n    }\n\n    fn github_content_url(&self, pkg: &AquaPackage, v: &str) -> String {\n        let gh_id = format!(\"{}/{}\", pkg.repo_owner, pkg.repo_name);\n        let path = pkg.path.as_deref().unwrap();\n        format!(\"https://raw.githubusercontent.com/{gh_id}/{v}/{path}\")\n    }\n","sourceCodeStart":2284,"sourceCodeEnd":2320,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/backend/aqua.rs#L2284-L2320","documentation":"This panic fires when `Url::parse(github::API_URL)` fails while building the GitHub API URL for a repo tarball lookup in the aqua backend. `github::API_URL` is a compile-time constant well-formed URL, so the parse only fails if that constant is corrupted or a non-canonical override was introduced. It is an internal invariant check, not a condition users can normally reach.","triggerScenarios":"Calling `github_archive_api_url` (aqua release asset resolution for github_release packages) when `github::API_URL` no longer parses as a valid absolute URL — realistically only after a code change or bad patch of the constant.","commonSituations":"Practically unreachable in production; seen only during development/refactoring of the github backend base URL (e.g. GitHub Enterprise URL experiments) or when mocking `github::API_URL` in tests with a malformed value.","solutions":["Verify `github::API_URL` in src/backend/github.rs is a well-formed absolute URL like \"https://api.github.com/\"","If overriding for GitHub Enterprise/testing, ensure the override is a full valid URL including scheme and trailing slash","Update mise to the latest version; report a bug with the backtrace if it reproduces on an unmodified build"],"exampleFix":"// before\nlet mut url = Url::parse(github::API_URL).expect(\"GitHub API URL should be valid\");\n// after\nlet mut url = Url::parse(github::API_URL)\n    .unwrap_or_else(|e| panic!(\"github::API_URL {:?} is not a valid URL: {e}\", github::API_URL));","handlingStrategy":"validation","validationCode":"let parsed = url::Url::parse(github::API_URL);\nassert!(parsed.is_ok(), \"github::API_URL must be a valid absolute URL: {:?}\", parsed.err());","typeGuard":"fn is_valid_url(s: &str) -> bool { url::Url::parse(s).map(|u| u.has_host()).unwrap_or(false) }","tryCatchPattern":"let url = match url::Url::parse(github::API_URL) { Ok(u) => u, Err(e) => { eprintln!(\"bad API_URL: {e}\"); return; } };","preventionTips":["Never patch github::API_URL with a partial or scheme-less value","Add a unit test asserting Url::parse(github::API_URL).is_ok()","If making the base configurable, validate overrides at settings-load time"],"tags":["rust","panic","url-parsing","aqua","internal-invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}