jdx/mise · error · eyre::Report

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

Error message

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

What it means

After downloading an additional artifact for a github: tool, mise compares the file's byte length against `artifact.size` recorded in the lock entry. A difference means the downloaded asset is not the exact artifact the lockfile describes — either the upstream asset changed or the wrong asset was fetched.

Source

Thrown at src/backend/github.rs:1597

        artifact: &mut ArtifactInfo,
    ) -> Result<()> {
        let filename = file_path.file_name().unwrap_or_default().to_string_lossy();
        if let Some(checksum) = &artifact.checksum {
            ctx.pr.set_message(format!("checksum {filename}"));
            let Some((algorithm, expected)) = checksum.split_once(':') else {
                eyre::bail!("Invalid checksum: {checksum}");
            };
            crate::hash::ensure_checksum(file_path, expected, Some(ctx.pr.as_ref()), algorithm)?;
        } else if Settings::get().lockfile_enabled() {
            ctx.pr.set_message(format!("generate checksum {filename}"));
            let hash = crate::hash::file_hash_blake3(file_path, Some(ctx.pr.as_ref()))?;
            artifact.checksum = Some(format!("blake3:{hash}"));
        }

        if let Some(expected_size) = artifact.size {
            let actual_size = file_path.metadata()?.len();
            if actual_size != expected_size {
                eyre::bail!(
                    "Size mismatch for {}: expected {}, got {}",
                    filename,
                    expected_size,
                    actual_size
                );
            }
        } else if Settings::get().lockfile_enabled() {
            artifact.size = Some(file_path.metadata()?.len());
        }
        Ok(())
    }

    fn install_additional_archive(
        &self,
        install_path: &Path,
        file_path: &Path,
        pr: Option<&dyn crate::ui::progress_report::SingleReport>,
    ) -> Result<()> {

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Clear the cached download and retry (`mise cache clean` or remove the tool's cache dir) to rule out a truncated file
  2. Regenerate the lock entry: `mise lock` (or delete the tool's mise.lock section first) so size matches the current asset
  3. Verify upstream: if the release asset really changed without a version bump, pin a different, stable version
Defensive patterns

Strategy: retry

Validate before calling

# compare local artifact size to the lock entry before relying on it
stat -c%s <cached-file>   # vs size field in mise.lock

Try / catch

mise install --locked || (mise cache clean && mise install --locked)

Prevention

When it happens

Trigger: A github release asset was re-uploaded or silently changed after `mise lock` recorded its size; a cached partial download; or the lockfile was generated against a different asset variant (platform/arch) than the one matched at install time.

Common situations: Upstream maintainer re-pushes a tag/release without a version bump; shared mise.lock across platforms where pattern matching picks different assets; flaky network leaving a truncated file in the download cache.

Related errors


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