{"record":{"id":"529600796d4a0092","repo":"jdx/mise","slug":"macos-release-targets-cannot-declare-a-libc-family","errorCode":null,"errorMessage":"macOS release targets cannot declare a libc family","messagePattern":"macOS release targets cannot declare a libc family","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1093,"sourceCode":"    format!(\"{RELEASE_BASE_URL}/v{version}/{filename}\")\n}\n\nfn release_asset_name(os: &str, arch: &str, libc: Option<LibcFlavor>) -> Result<String> {\n    let release_arch = match arch {\n        \"x86_64\" => \"x64\",\n        \"aarch64\" => \"arm64\",\n        \"armv7\" => \"armv7\",\n        _ => {\n            bail!(\n                \"mise {} has no official precompiled artifact for {os}/{arch}; set mise_bin, remote_mise, or bootstrap_command\",\n                env!(\"CARGO_PKG_VERSION\")\n            )\n        }\n    };\n    let suffix = match os {\n        \"macos\" if matches!(arch, \"x86_64\" | \"aarch64\") => {\n            if libc.is_some() {\n                bail!(\"macOS release targets cannot declare a libc family\");\n            }\n            format!(\"macos-{release_arch}\")\n        }\n        \"linux\" if matches!(arch, \"x86_64\" | \"aarch64\" | \"armv7\") => match libc {\n            Some(LibcFlavor::Glibc) => format!(\"linux-{release_arch}\"),\n            Some(LibcFlavor::Musl) => format!(\"linux-{release_arch}-musl\"),\n            None => bail!(\"Linux release targets require a detected libc family\"),\n        },\n        _ => {\n            bail!(\n                \"mise {} has no official precompiled artifact for {os}/{arch}; set mise_bin, remote_mise, or bootstrap_command\",\n                env!(\"CARGO_PKG_VERSION\")\n            )\n        }\n    };\n    Ok(format!(\"mise-v{}-{suffix}\", env!(\"CARGO_PKG_VERSION\")))\n}\n","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/remote.rs#L1075-L1111","documentation":"Defensive invariant in release_asset_name: a macOS target was passed with a libc flavor (Some(Glibc)/Some(Musl)). macOS release assets are named mise-v{version}-macos-{arch} with no libc suffix because macOS has a single system libc; declaring one would produce a nonexistent asset name. In the current code this is unreachable from config or CLI: parse_remote_platform maps non-Linux remotes to libc=None and official_release_assets passes None for macos, so hitting it means a new internal call site is passing wrong data.","triggerScenarios":"A Rust change calls release_asset_name(\"macos\", arch, Some(libc)) — e.g. someone reuses the Linux libc-detection path for macOS or constructs a RemotePlatform by hand with libc set.","commonSituations":"Refactoring the platform-detection code and accidentally widening the libc probe to non-Linux OSes; tests that build RemotePlatform values directly.","solutions":["Pass None as the libc argument whenever os is macos","Keep libc detection gated to Linux (as remote_platform_script does with its case statement)","Add a unit test asserting RemotePlatform for a macos host always carries libc: None"],"exampleFix":"// before\nlet asset = release_asset_name(\"macos\", \"aarch64\", Some(LibcFlavor::Glibc))?;\n\n// after\nlet asset = release_asset_name(\"macos\", \"aarch64\", None)?;","handlingStrategy":"validation","validationCode":"// Guard at the call site: macos must never carry a libc family\nlet libc = if platform.os == \"linux\" { platform.libc } else { None };\nlet asset = release_asset_name(&platform.os, &platform.arch, libc)?;","typeGuard":"fn valid_asset_request(os: &str, arch: &str, libc: Option<LibcFlavor>) -> bool {\n    match normalize_os(os).as_str() {\n        \"macos\" => libc.is_none() && matches!(normalize_arch(arch).as_str(), \"x86_64\" | \"aarch64\"),\n        \"linux\" => libc.is_some() && matches!(normalize_arch(arch).as_str(), \"x86_64\" | \"aarch64\" | \"armv7\"),\n        _ => false,\n    }\n}","tryCatchPattern":null,"preventionTips":["Keep libc detection Linux-only (mirror remote_platform_script's case statement)","Unit-test RemotePlatform construction: macos => libc must be None","When adding platform sources, assert invariants before calling release_asset_name"],"tags":["mise","internal-invariant","macos","libc","release-artifact"],"backgroundTag":"invalid-parameter-combination","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}