gitbutlerapp/gitbutler · error
In resolution mode, edit the files and run `but resolve…
Error message
In resolution mode, edit the files and run `but resolve finish` instead.
What it means
Mode guard in mark_worktree_conflicts_resolved: the repository is in Edit (resolution) mode, where conflicts are resolved by editing files and running 'but resolve finish', so direct mark-as-resolved is not allowed in this state.
Solutions
- Edit the conflicted files in your editor to the desired content
- Run `but resolve finish` to complete the resolution
- Avoid re-entering `but resolve <paths>` while in resolution mode
Example fix
// before but resolve src/app.rs # while in resolution mode // after $EDITOR src/app.rs but resolve finish
Defensive patterns
Strategy: validation
Validate before calling
let mode = operating_mode(ctx)?;
if matches!(mode.operating_mode, OperatingMode::Edit(_)) {
eprintln!("in resolution mode: edit files then 'but resolve finish'");
} Try / catch
if let Err(e) = resolve_paths(paths) {
if e.to_string().contains("In resolution mode") {
eprintln!("Finish the active resolution first: 'but resolve finish'");
}
} Prevention
- Check operating mode before issuing resolve commands
- Complete or abort the current resolution before starting another
- Avoid scripted resolve loops that can run during resolution mode
When it happens
Trigger: `but resolve <conflicted-paths>...` executed while `operating_mode(ctx)` reports OperatingMode::Edit.
Common situations: Entering resolution mode (via `but resolve <commit>`), then trying to bulk-mark files resolved instead of editing and finishing.
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…
- Commit is not in a conflicted state. Only conflicted…
- Conflicted uncommitted files can only be marked as…
- ' ' is not a conflicted uncommitted file; `but resolve`…
- You are in conflict resolution mode. Finish with `but…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/56a4518d2cb44f75.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/resolve.rs:132
let repo = ctx.repo.get()?;
let index = repo.index_or_empty()?;
Ok(index
.entries()
.iter()
.filter(|entry| entry.stage() != gix::index::entry::Stage::Unconflicted)
.map(|entry| entry.path(&index).to_string())
.collect())
}
/// Mark the conflicted uncommitted files at `paths` as resolved, taking their
/// current worktree content.
fn mark_worktree_conflicts_resolved(
ctx: &mut Context,
out: &mut OutputChannel,
paths: Vec<String>,
) -> Result<()> {
if matches!(operating_mode(ctx)?.operating_mode, OperatingMode::Edit(_)) {
bail!("In resolution mode, edit the files and run `but resolve finish` instead.");
}
but_api::workspace::resolve_worktree_conflicts(
ctx,
paths.iter().map(|p| BString::from(p.as_str())).collect(),
)?;
if let Some(json_out) = out.for_json() {
json_out.write_value(serde_json::json!({ "resolved_files": paths }))?;
} else if let Some(human_out) = out.for_human() {
let t = theme::get();
for path in &paths {
writeln!(
human_out,
"{} {}",
t.success.paint("✓ Marked as resolved:"),
t.attention.paint(path)
)?;
}
}View on GitHub (pinned to 58e5313667)