gitbutlerapp/gitbutler · error
Commit is not in a conflicted state. Only conflicted…
Error message
Commit {commit_ref} is not in a conflicted state. Only conflicted commits can be resolved. What it means
State validation in enter_resolution: the resolved commit exists but is not marked conflicted, and only conflicted commits can enter the resolution flow. The caller should verify with 'but status' which commits actually carry conflicts.
Solutions
- Run `but status` and confirm the commit shows as conflicted
- If already resolved, no action is needed — skip `but resolve <commit>`
- Choose the correct conflicted commit ID from the status output
Example fix
// before but resolve 9f2c1ab # clean commit // after but status # identify conflicted commit but resolve <conflicted-id>
Defensive patterns
Strategy: validation
Validate before calling
if !commit_is_conflicted(commit_id) { eprintln!("{commit_id} is not conflicted; nothing to resolve"); } Try / catch
if let Err(e) = enter_resolution(ctx, out, id) {
if e.to_string().contains("not in a conflicted state") {
eprintln!("Skip resolution; select a conflicted commit from 'but status'");
}
} Prevention
- Verify conflict markers/state with `but status` before resolving
- Skip already-resolved commits in automation
- Re-check commit state after rebases or upstream syncs
When it happens
Trigger: `but resolve <commit-id>` (or check_and_prompt_for_conflicts flow) on a commit whose merge state has no conflicts — e.g. already resolved, or a normal clean commit.
Common situations: Re-running resolve on a commit already finished; picking the wrong stack commit from `but status`; conflicts auto-resolved upstream before the command ran.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- --ai cannot be combined with a resolve subcommand. For one…
- Cannot amend a conflicted commit
- Conflicted uncommitted files can only be marked as…
- Destination commit must not be conflicted
- In resolution mode, edit the files and run `but resolve…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/244f4feebc1445ce.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/resolve.rs:207
}
_ => bail!("'{commit_id_str}' does not refer to a commit"),
}
}
fn enter_resolution(ctx: &mut Context, out: &mut OutputChannel, commit_id_str: &str) -> Result<()> {
let t = theme::get();
use gix::{prelude::ObjectIdExt as _, revision::walk::Sorting};
let (commit_gix_oid, commit_ref) = parse_commit_id(ctx, commit_id_str)?;
// Get the commit and check if it's conflicted
let repo = ctx.repo.get()?;
let commit = repo
.find_commit(commit_gix_oid)
.context("Failed to find commit")?;
if !commit.is_conflicted() {
bail!(
"Commit {commit_ref} is not in a conflicted state. Only conflicted commits can be resolved."
);
}
// Find which stack this commit belongs to
let stacks = crate::legacy::workspace::applied_stacks(ctx)?;
let mut found_stack_id = None;
'outer: for stack in &stacks {
// Check if this commit is in any of the stack's heads
// TODO(ctx): use `ws` for that.
// TODO(perf): This is likely to walk the whole graph.
for head in &stack.branches {
// Walk the commit history to see if our commit is in this stack
let traversal = head
.tip
.attach(&repo)
.ancestors()
.sorting(Sorting::BreadthFirst)View on GitHub (pinned to 58e5313667)