gitbutlerapp/gitbutler · error · anyhow::Error

The model returned a resolution for "{}", which was not requ

Error message

The model returned a resolution for "{}", which was not requested

What it means

After the LLM call, validate_ai_response() maps every returned resolution path onto the request's conflicted files (via normalize_path). A path that matches no requested conflicted file fails validation - the model answered a question that was not asked. resolve_commit_conflicts_with retries the whole model call once on this failure before giving up.

Source

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

        );
        attempt()
    })
}

/// Check the model response against the request and translate it into
/// full-coverage picks plus the per-file display payload. Any mismatch fails
/// validation so the caller can retry the model once before giving up.
fn validate_ai_response(
    request: &ResolutionRequest,
    response: &ResolutionResponse,
) -> anyhow::Result<(apply::PicksPerFile, Vec<ResolvedFile>)> {
    let files_by_path = apply::index_files_by_path(request)?;
    let mut picks: apply::PicksPerFile = vec![BTreeMap::new(); request.files.len()];
    let mut resolved_files: Vec<Option<ResolvedFile>> = vec![None; request.files.len()];

    for resolution in &response.resolutions {
        let Some(&index) = files_by_path.get(&apply::normalize_path(&resolution.path)) else {
            bail!(
                "The model returned a resolution for \"{}\", which was not requested",
                resolution.path
            );
        };
        if resolved_files[index].is_some() {
            bail!(
                "The model returned more than one resolution for \"{}\"",
                resolution.path
            );
        }
        let file = &request.files[index];
        if resolution.hunks.len() != file.hunks.len() {
            bail!(
                "The model returned {} resolved hunks for \"{}\" but the file has {} conflicts",
                resolution.hunks.len(),
                file.path,
                file.hunks.len()
            );

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Let the built-in retry run first - the second attempt often self-corrects
  2. Switch to a stronger model via AI settings (model_or_default) if hallucinated paths recur
  3. Fall back to resolve_commit_conflict_hunks with explicit paths, or edit mode, when full AI resolve keeps failing
Defensive patterns

Strategy: retry

Try / catch

try {
  await api.resolveCommitConflictsAi(commitId);
} catch (err) {
  if (String(err).includes('which was not requested')) {
    // one automatic retry already happened inside; one manual retry with the same request is reasonable
    await api.resolveCommitConflictsAi(commitId);
  } else throw err;
}

Prevention

When it happens

Trigger: The model hallucinates or renames a path (absolute vs repo-relative, fixed spelling, an imagined file), or 'helpfully' resolves a manual file that was never part of the request.files list. Also triggered when the model returns the path with different separator or casing that normalize_path does not smooth out.

Common situations: Weaker models paraphrasing paths; prompts where merged_text paths tempt the model to add files; strict schemas not enforced by the provider so the model drifts from the requested file set.

Related errors


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