gitbutlerapp/gitbutler · error

The conflict in " " cannot be resolved automatically…

Error message

The conflict in "{}" cannot be resolved automatically: {} Resolve this commit in edit mode instead.

What it means

Thrown by `resolve_commit_conflicts_with` when the built resolution request contains a file in its `manual` list — a conflict the model cannot be shown (e.g. it could not be rendered for the AI). Because this path promises a fully resolved commit and rebases descendants, an unresolvable file is a hard stop rather than being left conflicted (unlike `resolve_commit_conflict_hunks`).

Solutions

  1. Resolve the offending file manually in edit mode as the message suggests, then retry the automated resolution for the rest
  2. Exclude manual-only files from the commit before automated resolution, or split the commit
  3. Inspect why the file was classified manual (binary/undisplayable) and convert it if appropriate

Example fix

// before
await butApi.resolveCommitConflictsAi(commitId); // fails on manual file
// after
if (conflicts.some(c => c.manual)) {
  await butApi.openEditMode(commitId); // resolve manually
} else {
  await butApi.resolveCommitConflictsAi(commitId);
}
Defensive patterns

Strategy: fallback

Validate before calling

const req = buildRequest(commitId);
if (req.manual.length > 0) {
  // route to edit mode instead of AI resolution
  openEditMode(commitId);
}

Type guard

null

Try / catch

try {
  await api.resolveCommitConflictsAi(commitId);
} catch (e) {
  if (e.message.includes('cannot be resolved automatically')) {
    await api.openEditMode(commitId); // manual fallback
  }
}

Prevention

When it happens

Trigger: Calling `resolve_commit_conflicts_ai` or `resolve_commit_conflicts_with` for a commit where `request.manual.first()` is `Some`, i.e. at least one conflicted file was classified as requiring manual resolution.

Common situations: A conflicted file contains binary content or markers the AI request builder refuses to render; the commit mixes auto-resolvable and manual-only conflicts; tests like `invalid_response_is_retried_once_then_fails_without_changes` exercise this guard.

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/571c5354d125490c. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-api/src/resolve/mod.rs:555

/// malformed model output) or if its response fails validation against the
/// request.
pub fn resolve_commit_conflicts_with(
    ctx: &mut but_ctx::Context,
    commit_id: gix::ObjectId,
    dry_run: DryRun,
    resolve: impl Fn(&ResolutionRequest) -> anyhow::Result<ResolutionResponse>,
) -> anyhow::Result<AiResolutionResult> {
    let request = {
        let _guard = ctx.shared_worktree_access();
        let repo = ctx.repo.get()?;
        context::build_request(&repo, commit_id)?
    };
    // This path promises a fully resolved commit, so a file the model cannot be
    // shown is a hard stop rather than something to leave behind — unlike
    // `resolve_commit_conflict_hunks()`, which resolves what it is asked to and
    // leaves the rest conflicted by design.
    if let Some(file) = request.manual.first() {
        bail!(
            "The conflict in \"{}\" cannot be resolved automatically: {} Resolve this commit in edit mode instead.",
            file.path,
            file.reason
        );
    }

    // The model call happens without any worktree lock; the request is plain
    // data and the apply step below re-reads the workspace under the exclusive
    // lock, so it fails closed if the commit changed in the meantime.
    let ((picks, files), summary) = retry_once(|| {
        let response = resolve(&request)?;
        let validated = validate_ai_response(&request, &response)?;
        Ok((validated, response.summary))
    })?;

    let mut guard = ctx.exclusive_worktree_access();
    // The workspace graph may have been cached before or during the model
    // call; the commit-presence check in apply must run against the state

View on GitHub (pinned to 58e5313667)