jdx/mise · error

Size mismatch for : expected , got

Error message

Size mismatch for {}: expected {}, got {}

What it means

When a lockfile entry records an expected download size (`locked.size`), mise verifies the downloaded file's byte length matches before using it. A mismatch means the artifact on disk differs from what was locked — truncated download, corrupted cache, or a changed upstream release — so mise refuses to proceed.

Solutions

  1. Clear the cached download (remove the tool's download cache dir, e.g. `mise cache clear` or delete ~/.local/share/mise/downloads/<tool>) and reinstall.
  2. Run `mise lock` to regenerate the lockfile if the upstream artifact legitimately changed.
  3. Check network/proxy stability; retry the install on a reliable connection.

Example fix

// before: truncated cached artifact
$ mise install
Size mismatch for terraform-1.9.0.zip: expected 27123456, got 12000000

// after: clear cache and reinstall
$ mise cache clear && mise install
Defensive patterns

Strategy: retry

Validate before calling

# verify downloaded artifact size against lockfile before install
stat -c %s <cached-artifact>  # compare with locked.size in mise.lock

Prevention

When it happens

Trigger: Installing a locked tool where the downloaded artifact's file size != locked.size; interrupted/partial download cached on disk; upstream re-released (moved) a tag so the artifact changed after the lock was generated.

Common situations: Flaky network leaving a truncated tarball in the cache; a project republished its release assets; switching mirrors/proxies that alter the response.

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/94543fb1e3212413. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/mod.rs:4340

                )?;
            } else {
                bail!("Invalid checksum: {checksum}");
            }
        } else if lockfile_enabled {
            ctx.pr.set_message(format!("generate checksum {filename}"));
            let hash = hash::file_hash_blake3(file, Some(ctx.pr.as_ref()))?;
            tv.lock_platforms
                .entry(platform_key.clone())
                .or_default()
                .checksum = Some(format!("blake3:{hash}"));
        }

        // Handle size verification and generation
        if let Some(expected_size) = locked.size {
            ctx.pr.set_message(format!("verify size {filename}"));
            let actual_size = file.metadata()?.len();
            if actual_size != expected_size {
                bail!(
                    "Size mismatch for {}: expected {}, got {}",
                    filename,
                    expected_size,
                    actual_size
                );
            }
        } else if lockfile_enabled {
            tv.lock_platforms.entry(platform_key).or_default().size = Some(file.metadata()?.len());
        }
        Ok(())
    }

    /// Human-readable identity of the lock entry consulted for `tv` on
    /// `platform_key`, including the options that distinguish artifact variants.
    fn describe_lock_entry(&self, tv: &ToolVersion, platform_key: &str) -> String {
        let options = self
            .resolve_lockfile_options(&tv.request, &PlatformTarget::from_current())
            .unwrap_or_default();

View on GitHub (pinned to 533346cc37)