jdx/mise · error

transferred revision mismatch

Error message

transferred revision mismatch

What it means

After cloning the bundle, install_at verifies that the checked-out HEAD (`git rev-parse HEAD`) exactly equals the requested pinned revision. If the bundle's HEAD resolves to a different commit, the transfer did not deliver the requested revision and the install aborts rather than installing untrusted or wrong content.

Solutions

  1. Re-run the onboarding flow (fetch then install) so the bundle is regenerated for the same revision you pass.
  2. Confirm the SHA exists in the source repo: `git ls-remote <origin> <sha>`.
  3. Ensure the revision you pass is the one resolved at fetch time, not from an older cache.

Example fix

// before
let sha = cache.load("repo-sha")?; // stale
install_at(origin, &sha, ...).await?;
// after
let source = Source::fetch(origin.into()).await?;
install_at(origin, &source.revision, ...).await?; // same revision the bundle carries
Defensive patterns

Strategy: validation

Validate before calling

// ensure the revision you pin is the one Source::fetch captured
const source = await fetchSource(origin);
if (source.revision !== requestedRevision) throw new Error("stale revision; refetch");

Try / catch

try {
  await install_at(origin, rev);
} catch (e) {
  if (String(e).includes("transferred revision mismatch")) {
    // refetch the source and use its freshly resolved revision
  } else throw e;
}

Prevention

When it happens

Trigger: Calling install_at with a revision that exists upstream but was not the HEAD captured in the bundle — e.g. the source repo was re-fetched/advanced between bundle creation and install, or the caller passes a valid-format SHA that the bundle never contained.

Common situations: Race where the upstream repository was updated mid-onboarding; caller caching a stale SHA; passing a SHA from a different repository that happens to be valid hex.

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

Appendix: 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 533346cc37)