jdx/mise · error

Size mismatch: expected

Error message

Size mismatch: expected {}, got {}

What it means

verify_artifact checks the downloaded file's byte length against a declared 'size' metadata value. A mismatch means the download is truncated, corrupted, or the declared size is stale, so mise refuses to trust (and install) the artifact.

Solutions

  1. Delete the cached/partial download and retry the install
  2. Check disk space on the target filesystem
  3. Compare actual asset size on the release page; report upstream if the release asset changed
  4. Retry later if a CDN/mirror is serving stale content

Example fix

// before retrying
rm -rf ~/.cache/mise/downloads/<tool>/<version>
mise install <tool>@<version>
Defensive patterns

Strategy: retry

Validate before calling

// compare declared vs actual size before install
curl -sL -o artifact <url> && test "$(stat -c%s artifact)" = "$EXPECTED_SIZE" || echo "truncated download"

Prevention

When it happens

Trigger: download_and_install / install_version_ call verify_artifact; opts contains a 'size' key, size_str parses to u64, and file_path.metadata().len() differs from expected_size.

Common situations: Interrupted or proxied download, a CDN serving a truncated response, upstream re-uploading a release asset with different content while metadata still lists the old size, filesystem-level truncation on low disk space.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/backend/static_helpers.rs:887

    file_path: &Path,
    opts: &crate::toolset::ToolVersionOptions,
    pr: Option<&dyn SingleReport>,
) -> Result<()> {
    // Check platform-specific checksum first, then fall back to generic
    let checksum = lookup_with_fallback(opts, "checksum");

    if let Some(checksum) = checksum {
        verify_checksum_str(file_path, &checksum, pr)?;
    }

    // Check platform-specific size first, then fall back to generic
    let size_str = lookup_with_fallback(opts, "size");

    if let Some(size_str) = size_str {
        let expected_size: u64 = size_str.parse()?;
        let actual_size = file_path.metadata()?.len();
        if actual_size != expected_size {
            bail!(
                "Size mismatch: expected {}, got {}",
                expected_size,
                actual_size
            );
        }
    }

    Ok(())
}

pub(crate) fn verify_checksum_str(
    file_path: &Path,
    checksum: &str,
    pr: Option<&dyn SingleReport>,
) -> Result<()> {
    if let Some((algo, hash_str)) = checksum.split_once(':') {
        hash::ensure_checksum(file_path, hash_str, pr, algo)?;
    } else {

View on GitHub (pinned to 533346cc37)