jdx/mise · error

transferred revision mismatch

Error message

transferred revision mismatch

What it means

After unpacking the bundle and cloning it, install_at compares `git rev-parse HEAD` in the checkout against the requested revision. A mismatch means the bundle's tip differs from the pinned commit, so the install aborts to guarantee the installed files exactly match the pinned revision.

Source

Thrown at src/system/remote_repository.rs:223

    let temporary = if dry_run {
        tempfile::tempdir()?
    } else {
        tempfile::tempdir_in(parent)?
    };
    let checkout = temporary.path().join("checkout");
    let shown = crate::file::display_path(destination);
    let mut command = Command::new("git");
    crate::git::sanitize_git_command(&mut command);
    let output = command
        .args(["clone", "--no-checkout", "--"])
        .arg(bundle)
        .arg(&checkout)
        .output()?;
    if !output.status.success() {
        bail!("invalid transferred repository bundle");
    }
    if git(&checkout, &["rev-parse", "HEAD"])? != revision {
        bail!("transferred revision mismatch");
    }
    let entries = git(&checkout, &["ls-tree", "-r", "-z", "--name-only", revision])?;
    for entry in entries.split('\0').filter(|s| !s.is_empty()) {
        let path = Path::new(entry);
        if path
            .components()
            .any(|c| !matches!(c, std::path::Component::Normal(_)))
            || entry.split('/').any(|p| p.eq_ignore_ascii_case(".git"))
        {
            bail!("unsafe source repository path");
        }
        if entry.to_ascii_lowercase().ends_with(".local.toml") {
            bail!(
                "source contains machine-local configuration ({entry}); remove it from the repository before onboarding"
            );
        }
    }
    git(&checkout, &["remote", "set-url", "origin", origin])?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Re-fetch so the bundle contains exactly the pinned revision at its tip
  2. Use the revision that the bundle actually contains (read HEAD from the checkout)
  3. Purge cached bundles and repeat the full fetch/install cycle

Example fix

// before
install_at(origin, old_rev, ...); // old_rev no longer matches bundle HEAD
// after
let rev = fetch_bundle_head(origin);
install_at(origin, &rev, ...);
Defensive patterns

Strategy: retry

Validate before calling

// preflight: confirm the revision is the repository's current tip
// $ git ls-remote <origin> refs/heads/<branch>  # compare against pinned rev

Try / catch

match install_at(origin, &rev, dest) {
    Err(e) if e.to_string().contains("transferred revision mismatch") => {
        let fresh = resolve_current_tip(origin)?;
        install_at(origin, &fresh, dest)
    }
    other => other,
}

Prevention

When it happens

Trigger: install_at given revision R while the bundle's HEAD resolves to a different commit — bundle generated from another commit, force-push rewrote history, or stale bundle.

Common situations: Repo history rewritten between fetch and install; mixing a cached bundle with a newer pinned revision; typo'd SHA from a different repo.

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@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/a65d363de1d18824. Report an issue: GitHub.