jdx/mise · error · eyre::Report

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

Error message

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

What it means

Generic lockfile verification: after download, mise compares the artifact's actual byte length against `locked.size` recorded in mise.lock for the current platform. Any difference means the file on disk is not the exact locked artifact, so the install aborts to preserve reproducibility; when no size is recorded and lockfile is enabled, the size is generated instead.

Source

Thrown at src/backend/mod.rs:4059

                )?;
            } 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 6f52dcdf99)

Solutions

  1. Clear the download cache and retry: `mise cache clean` (or remove the tool's cache dir) to eliminate truncated files
  2. Regenerate the lock entries with `mise lock` so sizes match current assets, then commit mise.lock
  3. If the upstream asset genuinely changed under the same version, pin a different, immutable version
Defensive patterns

Strategy: retry

Try / catch

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

Prevention

When it happens

Trigger: Reinstalling a tool under lockfile verification when the downloaded artifact's length differs from mise.lock's recorded size — upstream re-published the asset, a truncated/cached partial download, or a lock entry generated from a different artifact variant (platform/arch/tag mismatch).

Common situations: Upstream silently replaces release assets without a version bump; interrupted downloads leaving truncated files in mise's cache; lockfiles generated against different asset selection (renamed release files); proxy/CDN serving different content lengths.

Related errors


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