jdx/mise · error

native binstall metadata should have a package URL

Error message

native binstall metadata should have a package URL

What it means

When installing a cargo crate via native binstall metadata, the code requires `binstall.pkg_url` to be present after merging discovered metadata. The panic means the crate's binstall metadata (cargo-binstall.toml / Cargo.toml [package.metadata.binstall]) never supplied a package URL template, so mise cannot know where to download the prebuilt artifact.

Source

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

    let target_platform = PlatformTarget::from_current();
    let manifest = download_crate_manifest(&package, tv, ctx).await?;
    let mut binstall = NativeBinstallMetadata::from_manifest(&manifest, &target, &target_platform)?;
    if binstall.disabled_strategies.contains("crate-meta-data") {
        return Ok(false);
    }
    if binstall.pkg_url.is_none() {
        let Some(discovered) =
            discover_native_binstall_metadata(&package, &crate_name, version, &target).await
        else {
            return Ok(false);
        };
        binstall.pkg_url = discovered.pkg_url;
        binstall.pkg_fmt = discovered.pkg_fmt;
    }
    let pkg_url = binstall
        .pkg_url
        .as_deref()
        .expect("native binstall metadata should have a package URL");

    let manifest_bins = native_manifest_bins(&manifest);
    let bins = native_bins_to_install(opts.bin(), &manifest_bins, &package, &crate_name);
    let bin_names = bins.iter().map(|bin| bin.name.clone()).collect::<Vec<_>>();
    let pkg_fmt = binstall.pkg_fmt.unwrap_or_else(|| "tgz".to_string());
    let package_format = native_package_format(&pkg_fmt)?;
    let binary_ext = if cfg!(windows) { ".exe" } else { "" };
    let archive_suffix = if package_format.extraction_format.is_some() {
        format!(".{}", package_format.template_value)
    } else {
        binary_ext.to_string()
    };
    let template_ctx = BinstallTemplateContext {
        package: &package,
        crate_name: &crate_name,
        version,
        target: &target,
        archive_format: package_format.template_value,

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Verify the crate actually publishes binstall metadata with `pkg-url` (and releases binaries) — check its repo's cargo-binstall config
  2. Fall back to source compilation: `mise settings set cargo_binstall false` or install with `cargo:<crate>` without binstall
  3. Add/fix `[package.metadata.binstall] pkg-url = "..."` in the crate if you own it and re-release
  4. Use an explicit backend install like `mise use cargo:<crate>` compiling from source instead

Example fix

# before (crate Cargo.toml metadata missing pkg-url)
[package.metadata.binstall]
pkg-fmt = "tgz"
# after
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.tar.gz"
pkg-fmt = "tgz"
Defensive patterns

Strategy: validation

Validate before calling

# before installing via native binstall, check the crate publishes binaries + metadata
crate=$(basename "$CRATE");
curl -fsSL "https://raw.githubusercontent.com/${OWNER}/${REPO}/main/Cargo.toml" | grep -q 'pkg-url' || echo 'no binstall pkg-url — compile from source instead'

Type guard

function hasBinstallUrl(meta) { return !!meta?.binstall?.pkg_url; }

Try / catch

if mise install cargo:foo 2>&1 | grep -q 'should have a package URL'; then echo 'falling back to source build'; MISE_CARGO_BINSTALL=false mise install cargo:foo; fi

Prevention

When it happens

Trigger: Running `mise use cargo:<crate>` (or installing with native binstall enabled) for a crate that publishes binstall metadata without a `pkg-url` key, or whose metadata discovery step returned partial metadata (pkg_fmt set but pkg_url missing).

Common situations: Crate authors add `[package.metadata.binstall]` with only `pkg-fmt` or incomplete overrides; a crate release changed its artifact naming so the URL template was dropped; no prebuilt artifacts are actually published for the crate.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/b06b7a403f238dd2. Report an issue: GitHub.