gitbutlerapp/gitbutler · error · anyhow::Error

Refusing to land `{branch}`: it is stacked on top of {} othe

Error message

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.

What it means

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.

Source

Thrown at crates/but-api/src/land/mod.rs:434

        bail!(
            "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.",
        );
    }
    // Key off the commits below, not the segment names: segments whose branch ref was deleted are
    // unnamed but their commits would be published all the same.
    let publishes_below = scan.commits_below > 0 || !scan.lower_segments.is_empty();
    if publishes_below && !whole_stack {
        if scan.lower_segments.is_empty() {
            bail!(
                "Refusing to land `{branch}`: {} commit(s) on unnamed segment(s) below it would \
                 also be published to {target_display}. Pass --whole-stack to land `{branch}` \
                 together with everything below it.",
                scan.commits_below,
            );
        }
        bail!(
            "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.",
            scan.lower_segments.len(),
            scan.lower_segments.join(", "),
            scan.lower_segments.last().expect("non-empty checked above"),
        );
    }

    if !scan.conflicted.is_empty() {
        bail!(
            "Cannot land `{branch}`: it would publish {} conflicted commit{} ({}). \
             Resolve them first with `but resolve <commit>`.",
            scan.conflicted.len(),
            if scan.conflicted.len() == 1 { "" } else { "s" },
            scan.conflicted.join(", "),
        );
    }

View on GitHub (pinned to caf1f223d3)

When it happens

Trigger: Thrown at crates/but-api/src/land/mod.rs:434 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/7e91aba80aab02c5. Report an issue: GitHub.