{"record":{"id":"cbfc09124feca2f7","repo":"gitbutlerapp/gitbutler","slug":"no-merge-base-found-for-revisions","errorCode":null,"errorMessage":"No merge-base found for revisions: {}","messagePattern":"No merge-base found for revisions: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-debug/src/command/revision.rs","lineNumber":139,"sourceCode":"            .entered();\n        graph\n            .find_merge_base_octopus(segments)\n            .map(|segment_id| {\n                graph\n                    .tip_skip_empty(segment_id)\n                    .map(|commit| commit.id)\n                    .with_context(|| {\n                        format!(\n                            \"BUG: Segment {segment_id:?} does not contain a reachable tip commit\"\n                        )\n                    })\n            })\n            .transpose()\n            .context(\"Failed to compute octopus merge-base from graph\")?\n    };\n\n    let Some(merge_base) = merge_base else {\n        bail!(\n            \"No merge-base found for revisions: {}\",\n            merge_base_args.revisions.join(\", \")\n        );\n    };\n    writeln!(out, \"{merge_base}\")?;\n\n    Ok(())\n}\n\nfn args_to_tips(repo: &gix::Repository, graph_args: &RevisionGraphArgs) -> Result<Vec<Tip>> {\n    let mut tips = Vec::new();\n\n    if let Some(tip) = graph_args\n        .target_ref\n        .as_deref()\n        .map(|target_ref| {\n            let mut reference = repo\n                .find_reference(target_ref)","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-debug/src/command/revision.rs#L121-L157","documentation":"`but debug revision merge-base` computes the merge-base of the given revisions using a commit graph. If the graph yields no common ancestor (None), this error bails with the joined revision list. It signals that the queried revisions share no merge-base, or the graph could not be built to find one.","triggerScenarios":"Running the merge-base command with revisions that have no common ancestor (e.g. unrelated histories, empty repo, or a single/zero revision set), or the octopus merge-base computation from the graph returns None.","commonSituations":"Comparing branches created with --orphan or from unrelated roots; typo'd revision names resolving to disjoint commits; running on a freshly initialized repository with no commits.","solutions":["Verify each revision exists: git rev-parse --verify <rev> for every argument","Check the revisions actually share history: git merge-base <a> <b>; if not, use --allow-unrelated-histories workflows or pass an ancestor commit","Ensure the repository has at least two commits with a common root before running the command"],"exampleFix":"// before\nbut debug revision merge-base main orphan-branch\n// after\ngit merge-base main orphan-branch  # confirm a base exists first\nbut debug revision merge-base main feature-branch","handlingStrategy":"validation","validationCode":"for rev in revisions {\n    let ok = std::process::Command::new(\"git\")\n        .args([\"rev-parse\", \"--verify\", rev])\n        .output()\n        .map(|o| o.status.success());\n    if !ok.unwrap_or(false) { return Err(format!(\"unknown revision: {rev}\")); }\n}","typeGuard":null,"tryCatchPattern":"match merge_base {\n    Ok(base) => println!(\"{base}\"),\n    Err(e) if e.to_string().contains(\"No merge-base found\") => {\n        eprintln!(\"revisions share no common ancestor; check histories\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify all revisions resolve with git rev-parse before invoking","Confirm the branches share a root with git merge-base first","Avoid merge-base queries on orphan/unrelated histories"],"tags":["git","merge-base","revisions","cli"],"backgroundTag":"resource-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}