{"record":{"id":"1f36185b6408adaa","repo":"jdx/mise","slug":"native-cargo-binary-artifact-maps-multiple-bins-to","errorCode":null,"errorMessage":"native cargo binary artifact maps multiple bins to {}","messagePattern":"native cargo binary artifact maps multiple bins to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/cargo/native_binstall.rs","lineNumber":1014,"sourceCode":"    if path.components().any(|component| {\n        matches!(\n            component,\n            Component::ParentDir | Component::Prefix(_) | Component::RootDir\n        )\n    }) {\n        bail!(\n            \"native cargo binary path must stay inside the artifact: {}\",\n            path.display()\n        );\n    }\n    Ok(path)\n}\n\nfn validate_native_bin_sources(pending: &[(PathBuf, PathBuf)]) -> Result<()> {\n    let mut sources = BTreeSet::new();\n    for (src, _) in pending {\n        if !sources.insert(src) {\n            bail!(\n                \"native cargo binary artifact maps multiple bins to {}\",\n                file::display_path(src)\n            );\n        }\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::platform::Platform;\n\n    #[test]\n    fn native_binstall_metadata_merges_target_overrides() {\n        let manifest = toml::Value::Table(toml::toml! {\n            [package.metadata.binstall]\n            pkg-url = \"{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }\"","sourceCodeStart":996,"sourceCodeEnd":1032,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/backend/cargo/native_binstall.rs#L996-L1032","documentation":"validate_native_bin_sources checks that the staged (source, destination) pairs for a native binstall install map each distinct source file to at most one destination. If two declared bins resolve to the same artifact file, installing both would clobber the same destination, so mise fails rather than silently overwriting.","triggerScenarios":"install() with a crate declaring multiple [[bin]] names (or repeated bin tool options) whose resolved find_native_bin paths collapse to the same file — e.g. two bin entries with identical names or templates that ignore the bin name.","commonSituations":"Duplicate `bin = \"x\"` entries in tool options; crate metadata listing the same bin twice or with case variants that normalize to one file on a case-insensitive filesystem; templated bin_dir where {{ bin }} was omitted.","solutions":["Remove duplicate/overlapping bin entries from the tool options so each bin maps to a distinct file.","Fix the crate's binstall metadata so each declared bin points to a unique artifact path.","Install only the single binary you actually need instead of the full bin list."],"exampleFix":"# before (mise.toml)\ncargo:mytool = { version = \"1.0\", bin = [\"cli\", \"cli\"] }\n\n# after\ncargo:mytool = { version = \"1.0\", bin = [\"cli\", \"cli-helper\"] }","handlingStrategy":"validation","validationCode":"# dedupe bin list before install\necho \"$bins\" | tr ' ' '\\n' | sort -u","typeGuard":"fn unique_bins(bins: &[String]) -> Vec<String> {\n    let mut seen = std::collections::BTreeSet::new();\n    bins.iter().filter(|b| seen.insert(b.to_lowercase())).cloned().collect()\n}","tryCatchPattern":null,"preventionTips":["Deduplicate bin lists in tool options","Remember case-insensitive filesystems can collide bin names","Ensure bin_dir templates include {{ bin }} so each bin maps to a distinct file"],"tags":["cargo","binstall","validation","duplicate"],"backgroundTag":"conflicting-config-options","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"}