{"record":{"id":"a178a70bf973480e","repo":"jdx/mise","slug":"multiple-merge-bases-require-explicit-git-reconcil","errorCode":null,"errorMessage":"multiple merge bases require explicit Git reconciliation before applying enrollment","messagePattern":"multiple merge bases require explicit Git reconciliation before applying enrollment","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/run.rs","lineNumber":975,"sourceCode":"pub(super) fn incoming_tracking(\n    repo: &crate::system::history::shadow::HistoryRepo,\n    tracked: &TrackedSet,\n) -> Result<TrackedSet> {\n    use crate::system::history::manifest::Manifest;\n    let heads = super::graph::Heads::read(repo)?;\n    let Some(remote) = &heads.remote else {\n        return Ok(tracked.clone());\n    };\n    let remote = Manifest::read(repo, remote)?\n        .ok_or_else(|| eyre::eyre!(\"setup repository has no enrollment metadata\"))?;\n    let manifest = match (&heads.local, &heads.base) {\n        (None, _) => remote,\n        (Some(local), Some(base)) => Manifest::merge(\n            &Manifest::read(repo, base)?.unwrap_or_default(),\n            &Manifest::read(repo, local)?.unwrap_or_default(),\n            &remote,\n        )?,\n        (Some(_), None) => bail!(\n            \"multiple merge bases require explicit Git reconciliation before applying enrollment\"\n        ),\n    };\n    let mut incoming = manifest.tracking()?;\n    incoming.required_sources = tracked.required_sources.clone();\n    incoming.invalid = tracked.invalid.clone();\n    Ok(incoming)\n}\n\n/// Complete-tree changes outside active native files still need adoption:\n/// enrollment, inactive variants, and ordinary repository documentation.\npub(super) fn incoming_repository_tree(\n    repo: &crate::system::history::shadow::HistoryRepo,\n    tracked: &TrackedSet,\n) -> Result<Option<String>> {\n    let heads = super::graph::Heads::read(repo)?;\n    let (Some(local), Some(remote)) = (&heads.local, &heads.remote) else {\n        return Ok(None);","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/sync/run.rs#L957-L993","documentation":"When applying an enrollment (first-time adoption of a remote setup), mise merges the incoming remote manifest with the local one via their merge base. Git reports multiple merge bases; the three-way manifest merge cannot pick a single ancestor, so mise refuses to guess and demands explicit Git reconciliation first. This prevents silently mis-merging tracking metadata during adoption.","triggerScenarios":"`incoming_tracking` (called from `prepare` during enrollment) sees `(Some(local), None)` — a local head exists but no unique merge base could be determined because the history has criss-cross merges / multiple bases.","commonSituations":"Enrolling onto a machine whose history repository was imported from divergent sources; a cloned history ref with criss-cross branch merges; manually rewritten history removing the common ancestor.","solutions":["Open the underlying history repository with git and reconcile manually (merge/cherry-pick to a single head), then retry enrollment","Reset the local history head to a single unambiguous commit before enrolling","If the local history is disposable, remove it and enroll fresh from the remote"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"git merge-base --all <local-history-head> <remote-history-head>   # expect exactly one base","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the history repository history linear (avoid criss-cross merges)","Reconcile divergent history refs with git before running enrollment"],"tags":["git","merge-base","sync","enrollment"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}