gitbutlerapp/gitbutler · error

" " cannot be resolved this way: Resolve this commit in…

Error message

"{path}" cannot be resolved this way: {} Resolve this commit in edit mode instead.

What it means

In `but resolve`, when the user supplies a resolution for a conflicted file, the command checks whether that path is a 'manual' conflict — one whose reason (e.g. file-level rename/delete/modify conflicts) cannot be fixed by applying hunk content or ours/theirs choices from the CLI. If the path matches a manual conflict entry, it bails telling the user to open edit mode instead.

Solutions

  1. Read the printed reason to see why the file cannot be auto-resolved
  2. Run `but` (edit mode) and resolve that commit's conflict interactively
  3. Or run `but resolve cancel`/`but resolve finish` once resolved in edit mode

Example fix

// before
but resolve <commit-id> "src/lib.rs":ours
// error: "src/lib.rs" cannot be resolved this way: rename/rename conflict...
// after
but  # open edit mode and resolve the commit interactively
Defensive patterns

Strategy: validation

Validate before calling

// before applying a resolution, check the path is not a manual conflict
const file = conflicts.manual.find(f => normalizePath(f.path) === lookupPath);
if (file) throw new Error(`Resolve "${file.path}" in edit mode: ${file.reason}`);

Type guard

const isAutoResolvable = (path, conflicts) =>
  !conflicts.manual.some(f => normalize(f.path) === normalize(path)) &&
  conflicts.files.some(f => normalize(f.path) === normalize(path));

Prevention

When it happens

Trigger: Running `but resolve <commit> <path>:ours|theirs|:<content>` (apply_resolutions, invoked from handle) where the given path normalizes to a file listed in conflicts.manual rather than conflicts.files.

Common situations: Resolving a rename/rename, delete/modify, or other non-hunk conflict from the CLI; typos are not the cause here — the file is conflicted, but its conflict type requires interactive edit mode.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

    // Expand a bare path into explicit per-hunk specs; an explicit `:<N>`
    // target needs no lookup, the API validates it.
    let hunks: Vec<usize> = match (hunk, &resolution) {
        (Some(hunk), _) => vec![hunk],
        (None, _) => {
            let conflicts = but_api::resolve::commit_conflicts(ctx, commit_oid)?;
            if conflicts.files.is_empty() && conflicts.manual.is_empty() {
                bail!("Commit {commit_oid} is not conflicted.");
            }
            // Match with the same normalization the API applies, so spellings
            // it would accept (`./`, backslashes, duplicate slashes) resolve.
            let lookup = but_api::resolve::normalize_path(path);
            if let Some(manual) = conflicts
                .manual
                .iter()
                .find(|file| but_api::resolve::normalize_path(&file.path) == lookup)
            {
                bail!(
                    "\"{path}\" cannot be resolved this way: {} Resolve this commit in edit mode instead.",
                    manual.reason
                );
            }
            let total_hunks = conflicts
                .files
                .iter()
                .find(|conflicted| but_api::resolve::normalize_path(&conflicted.path) == lookup)
                .map(|conflicted| conflicted.hunks.len())
                .with_context(|| format!("\"{path}\" is not a conflicted file of this commit"))?;
            match &resolution {
                HunkResolution::Ours | HunkResolution::Theirs | HunkResolution::Ai => {
                    (1..=total_hunks).collect()
                }
                HunkResolution::Content(_) if total_hunks == 1 => vec![1],
                HunkResolution::Content(_) => bail!(
                    "\"{path}\" has {total_hunks} conflicts; content applies to one at a time, use \"{path}:<N>\"."
                ),

View on GitHub (pinned to 58e5313667)