jdx/mise · error
native cargo binary path is empty
Error message
native cargo binary path is empty
What it means
validate_native_bin_relative_path sanitizes a relative path used for a native cargo binary inside the extracted artifact. If the path string has no components at all (empty or effectively empty), there is nothing to safely resolve, so it is rejected before any file operations.
Solutions
- Fix the binstall metadata / tool options so the binary path template yields a non-empty name.
- Ensure the crate's Cargo.toml declares the [[bin]] name you expect to install.
- Fall back to `cargo install` from source if the crate's prebuilt metadata is broken.
Example fix
# before (mise.toml tool options leaving bin empty)
cargo:mytool = { version = "1.0", bin = "" }
# after
cargo:mytool = { version = "1.0", bin = "mytool" } Defensive patterns
Strategy: validation
Validate before calling
# ensure bin path is non-empty before install
[ -n "$bin_path" ] || { echo 'bin path empty'; exit 1; } Type guard
fn non_empty_path(p: &str) -> Option<&str> {
if p.trim().is_empty() { None } else { Some(p) }
} Prevention
- Never leave bin/bin_dir options empty in tool config
- Check crate Cargo.toml [[bin]] names before pinning
- Validate templated values after expansion
When it happens
Trigger: Native binstall install resolving a bin's relative path where the configured/templated path string is empty — e.g. empty bin_dir template result, missing bin.name, or a variable expanding to nothing feeding validate_native_bin_relative_path.
Common situations: Malformed or incomplete binstall metadata for a crate; tool option or template producing an empty binary name; upstream binstall overrides with bin_dir: "".
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- native cargo binary artifact maps multiple bins to
- bootstrap_command returned an unsafe mise path
- brew-cask: command_wrapper requires a command name without…
- cargo-binstall cannot honor cargo install-only tool…
- cargo-binstall is disabled, but cargo.binstall_only is set
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/5ac96d3bd479e99d.
Report an issue: GitHub.
Appendix: source
Thrown at src/backend/cargo/native_binstall.rs:994
format!("{}-{}-{}", vars.name, vars.version, vars.target),
format!("{}-v{}-{}", vars.name, vars.version, vars.target),
format!("{}-{}", vars.name, vars.target),
format!("{}-{}", vars.name, vars.version),
format!("{}-v{}", vars.name, vars.version),
vars.name.to_string(),
];
for candidate in candidates {
if extract_dir.join(&candidate).is_dir() {
return format!("{candidate}/{{ bin }}{{ binary-ext }}");
}
}
"{ bin }{ binary-ext }".to_string()
}
fn validate_native_bin_relative_path(path: &str) -> Result<PathBuf> {
let path = PathBuf::from(path);
if path.components().next().is_none() {
bail!("native cargo binary path is empty");
}
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 {View on GitHub (pinned to 533346cc37)