{"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":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/backend/cargo/native_binstall.rs","lineNumber":1041,"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":1023,"sourceCodeEnd":1059,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/cargo/native_binstall.rs#L1023-L1059","documentation":"validate_native_bin_sources() ensures each declared bin maps to a distinct source file within one binstall artifact. If two entries in `pending` resolve to the same source path, the later install would overwrite the earlier binary — an ambiguous mapping mise refuses up front.","triggerScenarios":"A crate's binstall bin-dir template collapses multiple declared bins onto the same file (e.g. template ignoring `{ bin }`, or two bins aliased to one artifact path), so a BTreeSet insert of the same src fails for the second bin.","commonSituations":"Buggy binstall metadata for multi-binary crates; user-supplied bin-dir overrides in mise config that hardcode one file name for all bins; crates shipping one universal launcher file where metadata still declares several bins.","solutions":["Remove/fix custom bin-dir template overrides so each bin maps to its own file","Report the metadata bug upstream so the crate ships correct per-bin paths","Fall back to source install (`cargo install` builds each declared bin separately)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# when overriding bin-dir, ensure the template still interpolates { bin } per binary\ngrep -q '{ bin }' <<< \"$BIN_DIR_TEMPLATE\" || echo 'template must use { bin }'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep `{ bin }` in any custom bin-dir template so bins stay distinct","Report duplicate-source metadata upstream instead of working around it"],"tags":["cargo-binstall","duplicate-mapping","multi-bin","validation"],"backgroundTag":"duplicate-mapping","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}