jdx/mise · error

invalid transferred repository bundle

Error message

invalid transferred repository bundle

What it means

history_branch clones the transferred repository bundle with `git clone --no-checkout` to inspect history. If the clone of the bundle fails, the bundle itself is invalid — corrupted, truncated, or not a git bundle.

Source

Thrown at src/system/remote_repository.rs:149

        .unwrap_or(*crate::dirs::CONFIG)
        .to_path_buf()
}

/// The branch of a transferred bundle whose tree carries the setup
/// repository marker (`.mise-history/format.toml`); `None` for an ordinary
/// repository.
pub(crate) fn history_branch(bundle: &Path, revision: &str) -> Result<Option<String>> {
    let temporary = tempfile::tempdir()?;
    let checkout = temporary.path().join("checkout");
    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");
    }
    let marker = format!("{revision}:.mise-history/format.toml");
    if git(&checkout, &["cat-file", "-e", &marker]).is_err() {
        return Ok(None);
    }
    Ok(Some(git(&checkout, &["symbolic-ref", "--short", "HEAD"])?))
}

/// Installs the transferred revision as the global configuration checkout.
/// A dry run runs every check and says what it would do (clone, fast-forward,
/// adopt) without writing anything persistent.
pub(crate) fn install(
    bundle: &Path,
    origin: &str,
    revision: &str,
    update: bool,
    yes: bool,
    dry_run: bool,

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Re-run the fetch to regenerate a fresh repository bundle
  2. Verify the bundle with `git bundle verify <file>`
  3. Clear any cached/stale bundle files and retry
Defensive patterns

Strategy: retry

Validate before calling

// preflight: verify bundle integrity before use
// $ git bundle verify repository.bundle

Try / catch

match history_branch(&bundle, &revision) {
    Err(e) if e.to_string().contains("invalid transferred repository bundle") => {
        // re-fetch a fresh bundle once, then retry
        re_fetch_bundle(origin)?;
        history_branch(&bundle, &revision)
    }
    other => other,
}

Prevention

When it happens

Trigger: The bundle file produced during fetch is corrupt/missing (interrupted transfer, disk full) so `git clone --no-checkout -- <bundle>` exits nonzero.

Common situations: Partial download of the bundle over an unstable network, manual tampering, or a stale cached bundle from a failed previous run.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/ff1e00b213c3dec5. Report an issue: GitHub.