{"record":{"id":"518d7ec0276d5829","repo":"gitbutlerapp/gitbutler","slug":"the-model-returned-no-resolution-for-the-conflicte","errorCode":null,"errorMessage":"The model returned no resolution for the conflicted file \"{}\"","messagePattern":"The model returned no resolution for the conflicted file \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/resolve/mod.rs","lineNumber":661,"sourceCode":"            apply::ensure_no_markers(&hunk.resolved_content, &file.path)?;\n            picks[index].insert(\n                hunk_index,\n                apply::HunkPick::Content(hunk.resolved_content.clone()),\n            );\n        }\n        resolved_files[index] = Some(ResolvedFile {\n            path: file.path.clone(),\n            hunks: resolution\n                .hunks\n                .iter()\n                .map(|hunk| hunk.resolved_content.clone())\n                .collect(),\n            reasoning: resolution.reasoning.clone(),\n        });\n    }\n\n    if let Some(missing) = resolved_files.iter().position(Option::is_none) {\n        bail!(\n            \"The model returned no resolution for the conflicted file \\\"{}\\\"\",\n            request.files[missing].path\n        );\n    }\n\n    Ok((picks, resolved_files.into_iter().flatten().collect()))\n}\n\n/// Record an undo point, apply `picks`, and commit the snapshot on success.\nfn apply_with_snapshot(\n    ctx: &mut but_ctx::Context,\n    request: &ResolutionRequest,\n    picks: &apply::PicksPerFile,\n    operation: OperationKind,\n    dry_run: DryRun,\n    perm: &mut RepoExclusive,\n) -> anyhow::Result<apply::AppliedResolution> {\n    let maybe_oplog_entry = but_oplog::UnmaterializedOplogSnapshot::from_details_with_perm(","sourceCodeStart":643,"sourceCodeEnd":679,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/resolve/mod.rs#L643-L679","documentation":"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.","triggerScenarios":"`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`.","commonSituations":"Output truncation (max-token limit) drops later files; the model skips a file it deems unresolvable; a retry merges partial results from two attempts.","solutions":["Retry the AI request; raise the token limit or split the request into smaller batches of files","Validate/complete the response client-side by checking resolution paths against request files before submitting","Fall back to `resolve_commit_conflict_hunks` (partial resolution) or edit mode for commits with many conflicted files"],"exampleFix":"// before\nconst missing = request.files.filter(f => !resolutions.some(r => r.path === f.path));\nif (missing.length) throw new Error('incomplete'); // or submit anyway\n// after\nif (missing.length === 0) await api.resolveCommitConflictsWith(commitId, resolutions);\nelse await api.resolveConflictHunksForFiles(commitId, coveredResolutions); // partial path","handlingStrategy":"retry","validationCode":"const missing = request.files.filter(f => !response.resolutions.some(r => normalizePath(r.path) === normalizePath(f.path)));\nif (missing.length > 0) throw new Error('no resolution for: ' + missing.map(m => m.path).join(', '));","typeGuard":"null","tryCatchPattern":"try {\n  await api.resolveCommitConflictsWith(ctx, commitId, specs);\n} catch (e) {\n  if (e.message.includes('returned no resolution')) await retryOrFallBackToPartial();\n}","preventionTips":["Set a token limit high enough for all conflicted files","Batch large conflict sets into smaller AI requests","Verify full coverage before submitting an all-or-nothing resolution"],"tags":["ai","validation","incomplete-response"],"backgroundTag":"unexpected-response-shape","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}