{"record":{"id":"571c5354d125490c","repo":"gitbutlerapp/gitbutler","slug":"the-conflict-in-cannot-be-resolved-automatica","errorCode":null,"errorMessage":"The conflict in \"{}\" cannot be resolved automatically: {} Resolve this commit in edit mode instead.","messagePattern":"The conflict in \"(.+?)\" cannot be resolved automatically: (.+?) Resolve this commit in edit mode instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/resolve/mod.rs","lineNumber":555,"sourceCode":"/// malformed model output) or if its response fails validation against the\n/// request.\npub fn resolve_commit_conflicts_with(\n    ctx: &mut but_ctx::Context,\n    commit_id: gix::ObjectId,\n    dry_run: DryRun,\n    resolve: impl Fn(&ResolutionRequest) -> anyhow::Result<ResolutionResponse>,\n) -> anyhow::Result<AiResolutionResult> {\n    let request = {\n        let _guard = ctx.shared_worktree_access();\n        let repo = ctx.repo.get()?;\n        context::build_request(&repo, commit_id)?\n    };\n    // This path promises a fully resolved commit, so a file the model cannot be\n    // shown is a hard stop rather than something to leave behind — unlike\n    // `resolve_commit_conflict_hunks()`, which resolves what it is asked to and\n    // leaves the rest conflicted by design.\n    if let Some(file) = request.manual.first() {\n        bail!(\n            \"The conflict in \\\"{}\\\" cannot be resolved automatically: {} Resolve this commit in edit mode instead.\",\n            file.path,\n            file.reason\n        );\n    }\n\n    // The model call happens without any worktree lock; the request is plain\n    // data and the apply step below re-reads the workspace under the exclusive\n    // lock, so it fails closed if the commit changed in the meantime.\n    let ((picks, files), summary) = retry_once(|| {\n        let response = resolve(&request)?;\n        let validated = validate_ai_response(&request, &response)?;\n        Ok((validated, response.summary))\n    })?;\n\n    let mut guard = ctx.exclusive_worktree_access();\n    // The workspace graph may have been cached before or during the model\n    // call; the commit-presence check in apply must run against the state","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/resolve/mod.rs#L537-L573","documentation":"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`).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Resolve the offending file manually in edit mode as the message suggests, then retry the automated resolution for the rest","Exclude manual-only files from the commit before automated resolution, or split the commit","Inspect why the file was classified manual (binary/undisplayable) and convert it if appropriate"],"exampleFix":"// before\nawait butApi.resolveCommitConflictsAi(commitId); // fails on manual file\n// after\nif (conflicts.some(c => c.manual)) {\n  await butApi.openEditMode(commitId); // resolve manually\n} else {\n  await butApi.resolveCommitConflictsAi(commitId);\n}","handlingStrategy":"fallback","validationCode":"const req = buildRequest(commitId);\nif (req.manual.length > 0) {\n  // route to edit mode instead of AI resolution\n  openEditMode(commitId);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await api.resolveCommitConflictsAi(commitId);\n} catch (e) {\n  if (e.message.includes('cannot be resolved automatically')) {\n    await api.openEditMode(commitId); // manual fallback\n  }\n}","preventionTips":["Inspect request.manual before invoking automated resolution","Keep binary/undisplayable files out of AI-resolved commits","Provide an edit-mode path in any automated resolution flow"],"tags":["conflict-resolution","manual-intervention","ai"],"backgroundTag":"unsupported-operation","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"}