gitbutlerapp/gitbutler · error

In resolution mode, edit the files and run `but resolve fini

Error message

In resolution mode, edit the files and run `but resolve finish` instead.

What it means

When the workspace is in resolution (edit) mode — an active `but resolve <commit>` session — conflicted uncommitted files are managed inside that session. `mark_worktree_conflicts_resolved` checks `OperatingMode::Edit` (resolve.rs:131-133) and refuses ad-hoc marking, telling you to edit the files and conclude with `but resolve finish` so the session's bookkeeping stays consistent.

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 caf1f223d3)

Solutions

  1. Edit the conflicted files, then run `but resolve finish` to complete the session.
  2. If you want out of the session instead, run `but resolve cancel` (add `--force` if it warns about dropping your edits).
  3. Retry plain `but resolve <paths>` only after the session is finished or cancelled.

Example fix

# before
but resolve src/lib.rs   # while a resolution session is open -> refused

# after
# edit src/lib.rs to resolve the conflict markers, then
but resolve finish
Defensive patterns

Strategy: validation

Validate before calling

# If a resolve session is open, close it before ad-hoc conflict marking
but resolve finish 2>/dev/null || but resolve cancel
but resolve '<path>'

Prevention

When it happens

Trigger: Running `but resolve <paths>...` (the mark-resolved form) while a resolution session is still open — started earlier with `but resolve <commit>` and neither finished nor cancelled.

Common situations: Forgetting an earlier `but resolve <commit>` invocation; a session left open after an interrupted conflict workflow; automation hitting a workspace mid-session.

Related errors


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