gitbutlerapp/gitbutler · error · anyhow::Error

Cannot land {branch_name}: merging into {fetch_remote_name}/

Error message

Cannot land {branch_name}: merging into {fetch_remote_name}/{target_branch_name} resulted in conflicts.{detail} Rebase {branch_name} onto the target and resolve, then re-run `but land {branch_name}`.

What it means

Error "Cannot land {branch_name}: merging into {fetch_remote_name}/{target_branch_name} resulted in conflicts.{detail} Rebase {branch_name} onto the target and resolve, then re-run `but land {branch_name}`." thrown in gitbutlerapp/gitbutler.

Source

Thrown at crates/but-api/src/land/merge.rs:102

    let mut merge = repo.merge_trees(
        base_tree,
        our_tree,
        their_tree,
        repo.default_merge_labels(),
        merge_options,
    )?;
    if merge.has_unresolved_conflicts(unresolved) {
        let paths: Vec<String> = merge
            .conflicts
            .iter()
            .filter_map(|c| c.ours.location().to_str().ok().map(ToOwned::to_owned))
            .collect();
        let detail = if paths.is_empty() {
            String::new()
        } else {
            format!(" Conflicting paths: {}.", paths.join(", "))
        };
        bail!(
            "Cannot land {branch_name}: merging into {fetch_remote_name}/{target_branch_name} \
             resulted in conflicts.{detail} Rebase {branch_name} onto the target and resolve, then \
             re-run `but land {branch_name}`."
        );
    }
    let merged_tree = merge.tree.write()?.detach();

    // Build the 2-parent merge commit. Parent order is `[target, feature]` so `--first-parent`
    // mainline walks stay correct. `commit_signatures()` honors `gitbutler.gitbutlerCommitter`.
    let (author, committer) = repo.commit_signatures()?;
    let mut commit = gix::objs::Commit {
        tree: merged_tree,
        parents: [target_oid, feature_oid].into_iter().collect(),
        author,
        committer,
        encoding: None,
        message: format!("Merge branch '{branch_name}'").into(),
        extra_headers: Vec::new(),

View on GitHub (pinned to caf1f223d3)

When it happens

Trigger: Thrown at crates/but-api/src/land/merge.rs:102 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/d25fd66686c3606c. Report an issue: GitHub.