jdx/mise · error · eyre::Report

native cargo binary artifact maps multiple bins to {}

Error message

native cargo binary artifact maps multiple bins to {}

What it means

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.

Source

Thrown at src/backend/cargo/native_binstall.rs:1041

    if path.components().any(|component| {
        matches!(
            component,
            Component::ParentDir | Component::Prefix(_) | Component::RootDir
        )
    }) {
        bail!(
            "native cargo binary path must stay inside the artifact: {}",
            path.display()
        );
    }
    Ok(path)
}

fn validate_native_bin_sources(pending: &[(PathBuf, PathBuf)]) -> Result<()> {
    let mut sources = BTreeSet::new();
    for (src, _) in pending {
        if !sources.insert(src) {
            bail!(
                "native cargo binary artifact maps multiple bins to {}",
                file::display_path(src)
            );
        }
    }
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::platform::Platform;

    #[test]
    fn native_binstall_metadata_merges_target_overrides() {
        let manifest = toml::Value::Table(toml::toml! {
            [package.metadata.binstall]
            pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }"

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Remove/fix custom bin-dir template overrides so each bin maps to its own file
  2. Report the metadata bug upstream so the crate ships correct per-bin paths
  3. Fall back to source install (`cargo install` builds each declared bin separately)
Defensive patterns

Strategy: validation

Validate before calling

# when overriding bin-dir, ensure the template still interpolates { bin } per binary
grep -q '{ bin }' <<< "$BIN_DIR_TEMPLATE" || echo 'template must use { bin }'

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/1f36185b6408adaa. Report an issue: GitHub.