{"record":{"id":"585436befe566679","repo":"gitbutlerapp/gitbutler","slug":"refusing-to-land-branch-with-whole-stack-it-585436","errorCode":null,"errorMessage":"Refusing to land `{branch}` with --whole-stack: it is not the top of its stack — unnamed segment(s) with commits sit above it (their branch refs no longer exist), so landing `{branch}` would not land the entire stack.","messagePattern":"Refusing to land `(.+?)` with --whole-stack: it is not the top of its stack — unnamed segment\\(s\\) with commits sit above it \\(their branch refs no longer exist\\), so landing `(.+?)` would not land the entire stack\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-api/src/land/mod.rs","lineNumber":416,"sourceCode":"    ctx: &mut Context,\n    branch: &str,\n    target_display: &str,\n    whole_stack: bool,\n) -> anyhow::Result<Vec<String>> {\n    let Some(scan) = scan_stack(ctx, branch)? else {\n        return Ok(Vec::new());\n    };\n\n    if whole_stack && scan.has_upper {\n        // Judge \"top of the stack\" by position, not by names: a segment whose branch ref was\n        // deleted still holds commits that \"land the entire stack\" would have to include.\n        if let Some(top) = scan.upper_segments.first() {\n            bail!(\n                \"Refusing to land `{branch}` with --whole-stack: it is not the top of its stack. \\\n                 --whole-stack lands the entire stack; name its top segment `{top}` instead.\",\n            );\n        }\n        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!(","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-api/src/land/mod.rs#L398-L434","documentation":"Error \"Refusing to land `{branch}` with --whole-stack: it is not the top of its stack — unnamed segment(s) with commits sit above it (their branch refs no longer exist), so landing `{branch}` would not land the entire stack.\" thrown in gitbutlerapp/gitbutler.","triggerScenarios":"Thrown at crates/but-api/src/land/mod.rs:416 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-14T00:17:10.932Z"}