gitbutlerapp/gitbutler · error

The model returned no resolution for the conflicted file

Error message

The model returned no resolution for the conflicted file "{}"

What it means

After collecting resolutions, `validate_ai_response` checks that every requested conflicted file received a resolution (`resolved_files` has no `None` entry). A missing file means the model resolved only part of the conflict set; since this path promises a fully resolved commit, the response is rejected.

Solutions

  1. Retry the AI request; raise the token limit or split the request into smaller batches of files
  2. Validate/complete the response client-side by checking resolution paths against request files before submitting
  3. Fall back to `resolve_commit_conflict_hunks` (partial resolution) or edit mode for commits with many conflicted files

Example fix

// before
const missing = request.files.filter(f => !resolutions.some(r => r.path === f.path));
if (missing.length) throw new Error('incomplete'); // or submit anyway
// after
if (missing.length === 0) await api.resolveCommitConflictsWith(commitId, resolutions);
else await api.resolveConflictHunksForFiles(commitId, coveredResolutions); // partial path
Defensive patterns

Strategy: retry

Validate before calling

const missing = request.files.filter(f => !response.resolutions.some(r => normalizePath(r.path) === normalizePath(f.path)));
if (missing.length > 0) throw new Error('no resolution for: ' + missing.map(m => m.path).join(', '));

Type guard

null

Try / catch

try {
  await api.resolveCommitConflictsWith(ctx, commitId, specs);
} catch (e) {
  if (e.message.includes('returned no resolution')) await retryOrFallBackToPartial();
}

Prevention

When it happens

Trigger: `response.resolutions` covers fewer files than `request.files` — the first unmatched file's path is reported — when calling `resolve_ai_specs` or `resolve_commit_conflicts_with`.

Common situations: Output truncation (max-token limit) drops later files; the model skips a file it deems unresolvable; a retry merges partial results from two attempts.

Related errors


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

Appendix: source

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

            apply::ensure_no_markers(&hunk.resolved_content, &file.path)?;
            picks[index].insert(
                hunk_index,
                apply::HunkPick::Content(hunk.resolved_content.clone()),
            );
        }
        resolved_files[index] = Some(ResolvedFile {
            path: file.path.clone(),
            hunks: resolution
                .hunks
                .iter()
                .map(|hunk| hunk.resolved_content.clone())
                .collect(),
            reasoning: resolution.reasoning.clone(),
        });
    }

    if let Some(missing) = resolved_files.iter().position(Option::is_none) {
        bail!(
            "The model returned no resolution for the conflicted file \"{}\"",
            request.files[missing].path
        );
    }

    Ok((picks, resolved_files.into_iter().flatten().collect()))
}

/// Record an undo point, apply `picks`, and commit the snapshot on success.
fn apply_with_snapshot(
    ctx: &mut but_ctx::Context,
    request: &ResolutionRequest,
    picks: &apply::PicksPerFile,
    operation: OperationKind,
    dry_run: DryRun,
    perm: &mut RepoExclusive,
) -> anyhow::Result<apply::AppliedResolution> {
    let maybe_oplog_entry = but_oplog::UnmaterializedOplogSnapshot::from_details_with_perm(

View on GitHub (pinned to 58e5313667)