{"record":{"id":"5b82c1be647c7a22","repo":"gitbutlerapp/gitbutler","slug":"validation","errorCode":"Validation","errorMessage":"Commit {commit_id} is not conflicted","messagePattern":"Commit (.+?) is not conflicted","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/resolve/context.rs","lineNumber":134,"sourceCode":"}\n\n#[cfg(feature = \"export-schema\")]\nbut_schemars::register_sdk_type!(ManualConflict);\n\n/// Re-merge the conflict trees of `commit_id` and extract all conflict hunks.\n///\n/// Conflicts with no marker block to splice a resolution into — side deletions,\n/// non-blob entries, binary or oversized files — are reported in `manual`\n/// rather than failing the request, so the rest of the commit stays workable.\npub fn build_request(\n    repo: &gix::Repository,\n    commit_id: gix::ObjectId,\n) -> anyhow::Result<ResolutionRequest> {\n    use gix::prelude::ObjectIdExt as _;\n\n    let commit = but_core::Commit::from_id(commit_id.attach(repo))?;\n    let Some((base, ours, theirs)) = commit.conflicted_tree_ids()? else {\n        bail!(\n            anyhow::anyhow!(Code::Validation)\n                .context(format!(\"Commit {commit_id} is not conflicted\"))\n        );\n    };\n\n    let commit_message = but_core::commit::strip_conflict_markers(commit.message.as_ref())\n        .to_str_lossy()\n        .into_owned();\n    let parent_message = commit\n        .parents\n        .first()\n        .and_then(|parent_id| but_core::Commit::from_id(parent_id.attach(repo)).ok())\n        .map(|parent| commit_title(&parent));\n\n    let (base, ours, theirs) = (base.detach(), ours.detach(), theirs.detach());\n    let repo = repo.clone().for_tree_diffing()?;\n    // Merge without favoring a side to reproduce the actual conflicts, and\n    // force diff3-style markers with the sentinel labels so every hunk carries","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/resolve/context.rs#L116-L152","documentation":"build_request can only build a resolution request for a commit whose tree is in a conflicted state (base/ours/theirs trees recorded). When the commit has no conflicted tree ids, there is nothing to resolve, and a Validation-coded error is raised.","triggerScenarios":"Calling build_request (public resolve API) with a commit_id whose commit.conflicted_tree_ids() returns None — i.e. a normal, non-conflicted commit.","commonSituations":"Client UI stale state showing a commit as conflicted after it was already resolved, passing the wrong commit id (a parent instead of the conflicted one), or race where another process resolved the conflicts first.","solutions":["Verify the commit id actually refers to a conflicted commit (re-list conflicted commits)","Refresh local state and re-fetch the workspace before calling build_request","If the conflict was already resolved, proceed without invoking the resolve flow"],"exampleFix":"// before\nresolve_commit(commit_id_of_clean_parent)\n// after\nlet conflicted = list_conflicted_commits();\nif conflicted.contains(&commit_id) { resolve_commit(commit_id) }","handlingStrategy":"validation","validationCode":"const conflicted = await listConflictedCommits(); if (!conflicted.includes(commitId)) throw new Error('commit is not conflicted');","typeGuard":null,"tryCatchPattern":"try { await buildRequest(commitId); } catch (e) { if (String(e).includes('is not conflicted')) { /* skip resolution flow */ } else { throw e; } }","preventionTips":["Check conflicted-commit list before invoking resolution APIs","Refresh workspace state after external git operations","Guard against stale commit ids in UI state"],"tags":["validation","merge-conflict","invalid-state"],"backgroundTag":"invalid-state-transition","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"}