gitbutlerapp/gitbutler · error

Branch " " has no conflicted commits.

Error message

Branch "{name}" has no conflicted commits.

What it means

Thrown by target_conflicted_commit when the user names a branch as the conflict target for `but resolve`, but that branch has no conflicted commits recorded in conflicts_by_branch. The branch exists and parses, it simply is not part of any conflict. It is a lookup miss against the current conflict state.

Solutions

  1. Run `but status` or `but resolve` with no target to list conflicted commits/branches.
  2. Verify the branch name spelling.
  3. Resolve on the branch that actually carries the conflicted commit.
Defensive patterns

Strategy: validation

Validate before calling

const conflictedBranches = listConflicts().map(c => c.branch);
if (!conflictedBranches.includes(branchName)) throw new Error(`Branch "${branchName}" has no conflicted commits`);

Try / catch

try { await butResolve(branch) } catch (e) { if (String(e).includes('has no conflicted commits')) { showConflictList(); } }

Prevention

When it happens

Trigger: Running `but resolve <branchname> ...` (via list_conflicts or apply_resolutions) where the named branch is healthy — no merge/apply conflicts are pending on it.

Common situations: Typo in the branch name; the conflict was already resolved on that branch; or the user assumes a branch is conflicted because another one is.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/7b5da197f858ce1f. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/legacy/resolve.rs:671

/// Resolve `target` — a commit id, a CLI id, or a branch name (meaning that
/// branch's oldest conflicted commit) — or default to the oldest conflicted
/// commit of the first conflicted branch. `Ok(None)` means nothing is
/// conflicted.
fn target_conflicted_commit(
    ctx: &mut Context,
    target: Option<&str>,
) -> Result<Option<ConflictTarget>> {
    let conflicts_by_branch = find_conflicted_commits(ctx)?;
    let commit_oid = match target {
        // An exact conflicted-branch name scopes to that branch.
        Some(target) if conflicts_by_branch.contains_key(target) => {
            conflicts_by_branch[target][0].commit_oid
        }
        Some(target) => match parse_commit_or_branch(ctx, target)? {
            CommitOrBranch::Commit(commit_oid) => commit_oid,
            CommitOrBranch::Branch(name) => match conflicts_by_branch.get(&name) {
                Some(commits) => commits[0].commit_oid,
                None => bail!("Branch \"{name}\" has no conflicted commits."),
            },
        },
        None => match conflicts_by_branch.values().flatten().next() {
            Some(commit) => commit.commit_oid,
            None => return Ok(None),
        },
    };

    let branch = conflicts_by_branch
        .iter()
        .find(|(_, commits)| commits.iter().any(|commit| commit.commit_oid == commit_oid))
        .map(|(branch, _)| branch.clone());
    let other_conflicted = conflicts_by_branch
        .values()
        .flatten()
        .filter(|commit| commit.commit_oid != commit_oid)
        .map(|commit| commit.commit_oid)
        .collect::<HashSet<_>>()

View on GitHub (pinned to 58e5313667)