{"record":{"id":"7e91aba80aab02c5","repo":"gitbutlerapp/gitbutler","slug":"refusing-to-land-branch-it-is-stacked-on-top","errorCode":null,"errorMessage":"Refusing to land `{branch}`: it is stacked on top of {} other segment(s) ({}) whose commits would also be published to {target_display}. Land the bottom segment `{}`, or pass --whole-stack to land `{branch}` together with everything below it.","messagePattern":"Refusing to land `(.+?)`: it is stacked on top of (.+?) other segment\\(s\\) \\((.+?)\\) whose commits would also be published to (.+?)\\. Land the bottom segment `(.+?)`, or pass --whole-stack to land `(.+?)` together with everything below it\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-api/src/land/mod.rs","lineNumber":434,"sourceCode":"        bail!(\n            \"Refusing to land `{branch}` with --whole-stack: it is not the top of its stack — \\\n             unnamed segment(s) with commits sit above it (their branch refs no longer exist), so \\\n             landing `{branch}` would not land the entire stack.\",\n        );\n    }\n    // Key off the commits below, not the segment names: segments whose branch ref was deleted are\n    // unnamed but their commits would be published all the same.\n    let publishes_below = scan.commits_below > 0 || !scan.lower_segments.is_empty();\n    if publishes_below && !whole_stack {\n        if scan.lower_segments.is_empty() {\n            bail!(\n                \"Refusing to land `{branch}`: {} commit(s) on unnamed segment(s) below it would \\\n                 also be published to {target_display}. Pass --whole-stack to land `{branch}` \\\n                 together with everything below it.\",\n                scan.commits_below,\n            );\n        }\n        bail!(\n            \"Refusing to land `{branch}`: it is stacked on top of {} other segment(s) ({}) \\\n             whose commits would also be published to {target_display}. Land the bottom segment \\\n             `{}`, or pass --whole-stack to land `{branch}` together with everything below it.\",\n            scan.lower_segments.len(),\n            scan.lower_segments.join(\", \"),\n            scan.lower_segments.last().expect(\"non-empty checked above\"),\n        );\n    }\n\n    if !scan.conflicted.is_empty() {\n        bail!(\n            \"Cannot land `{branch}`: it would publish {} conflicted commit{} ({}). \\\n             Resolve them first with `but resolve <commit>`.\",\n            scan.conflicted.len(),\n            if scan.conflicted.len() == 1 { \"\" } else { \"s\" },\n            scan.conflicted.join(\", \"),\n        );\n    }","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-api/src/land/mod.rs#L416-L452","documentation":"Error \"Refusing to land `{branch}`: it is stacked on top of {} other segment(s) ({}) whose commits would also be published to {target_display}. Land the bottom segment `{}`, or pass --whole-stack to land `{branch}` together with everything below it.\" thrown in gitbutlerapp/gitbutler.","triggerScenarios":"Thrown at crates/but-api/src/land/mod.rs:434 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}