jdx/mise · error

multiple merge bases require explicit Git reconciliation…

Error message

multiple merge bases require explicit Git reconciliation before applying enrollment

What it means

When building the incoming tracking manifest, mise merges the remote manifest with the local one using a merge base. If there is a local head but no merge base (disjoint histories), a three-way merge is impossible to do safely at the manifest level, so mise requires the user to reconcile the histories in Git explicitly before enrollment is applied.

Solutions

  1. Reconcile the histories in Git explicitly: merge the upstream branch with `--allow-unrelated-histories` (resolving conflicts), then re-run sync.
  2. If the local history is disposable, re-initialize/re-clone from the origin so both sides share history, then sync.
  3. If upstream was rewritten intentionally, reset local sync state to the new upstream (re-connect origin / pull fresh) before syncing.

Example fix

// before: unrelated histories block manifest merge
mise dot sync // error: multiple merge bases require explicit Git reconciliation
// after: reconcile in Git first
git fetch origin
git merge origin/<branch> --allow-unrelated-histories  # resolve conflicts
mise dot sync
Defensive patterns

Strategy: fallback

Validate before calling

// detect a missing merge base before syncing
let base = repo.merge_base(local_head, upstream_head)?;
if base.is_none() {
    eprintln!("reconcile histories in git first (--allow-unrelated-histories)");
    return;
}

Type guard

fn mergeable(local: Option<Oid>, base: Option<Oid>) -> bool {
    match (local, base) { (Some(_), None) => false, _ => true }
}

Try / catch

match sync() {
    Err(e) if e.to_string().contains("multiple merge bases require explicit Git reconciliation") => eprintln!("git merge --allow-unrelated-histories origin/<branch>, then retry"),
    other => other,
}

Prevention

When it happens

Trigger: `mise dot sync`/prepare reaching incoming_tracking with (Some(local_head), None merge base) — i.e. the local history and the incoming upstream history share no common ancestor (unrelated histories).

Common situations: The upstream repository's history was rewritten or replaced wholesale (force-push of an unrelated root); the local repository was re-initialized with a fresh history; pointing mise at a repo cloned independently with different roots.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at src/system/history/sync/run.rs:1005

pub(super) fn incoming_tracking(
    repo: &crate::system::history::shadow::HistoryRepo,
    tracked: &TrackedSet,
) -> Result<TrackedSet> {
    use crate::system::history::manifest::Manifest;
    let heads = super::graph::Heads::read(repo)?;
    let Some(remote) = &heads.remote else {
        return Ok(tracked.clone());
    };
    let remote = Manifest::read(repo, remote)?
        .ok_or_else(|| eyre::eyre!("setup repository has no enrollment metadata"))?;
    let manifest = match (&heads.local, &heads.base) {
        (None, _) => remote,
        (Some(local), Some(base)) => Manifest::merge(
            &Manifest::read(repo, base)?.unwrap_or_default(),
            &Manifest::read(repo, local)?.unwrap_or_default(),
            &remote,
        )?,
        (Some(_), None) => bail!(
            "multiple merge bases require explicit Git reconciliation before applying enrollment"
        ),
    };
    let mut incoming = manifest.tracking()?;
    incoming.required_sources = tracked.required_sources.clone();
    incoming.invalid = tracked.invalid.clone();
    Ok(incoming)
}

/// Complete-tree changes outside active native files still need adoption:
/// enrollment, inactive variants, and ordinary repository documentation.
pub(super) fn incoming_repository_tree(
    repo: &crate::system::history::shadow::HistoryRepo,
    tracked: &TrackedSet,
) -> Result<Option<String>> {
    let heads = super::graph::Heads::read(repo)?;
    let (Some(local), Some(remote)) = (&heads.local, &heads.remote) else {
        return Ok(None);

View on GitHub (pinned to 533346cc37)