gitbutlerapp/gitbutler · error
Re-merging the conflicting trees of commit
Error message
Re-merging the conflicting trees of commit {commit_id} yielded no conflicts to resolve What it means
After reconstructing the merged tree, the library re-applies conflicts to the index and expects conflicts to appear. If the index is unchanged, re-merging the two conflicting trees produced no resolvable conflicts — likely the trees are actually mergeable cleanly or the conflicted-state metadata is stale — so building a request would be meaningless.
Solutions
- Refresh workspace state — the conflict is likely already resolved
- If the commit's trees are genuinely identical, drop the resolution flow and use the merged result
- Re-detect conflicts to get updated conflicted commit ids
Example fix
// before
build_request(repo, stale_commit_id)
// after
let conflicted = detect_conflicts(workspace)?;
if conflicted.iter().any(|c| c.commit_id == commit_id) { build_request(repo, commit_id) } Defensive patterns
Strategy: validation
Validate before calling
const c = await listConflictedCommits(); if (!c.some(x => x.commitId === commitId && x.needsResolution)) throw new Error('nothing to resolve'); Try / catch
try { await buildRequest(commitId); } catch (e) { if (String(e).includes('yielded no conflicts')) { /* treat as already resolved, skip */ } else { throw e; } } Prevention
- Re-detect conflicts before each resolution attempt
- Handle the already-resolved race between detection and request building
- Treat this error as a signal the conflict is resolved
When it happens
Trigger: build_request re-merges base/ours/theirs trees; outcome.index_changed_after_applying_conflicts returns false, meaning the merge succeeded cleanly or yielded no entries the index marks as unresolved.
Common situations: The conflict was recorded but both sides are now identical content, a merge tool previously auto-resolved files but the conflicted tree ids were kept, or race where the commit was resolved concurrently.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Commit has no conflicted files to resolve
- Validation
- Cannot merge : merging into / resulted in conflicts. Rebase…
- cannot mix mark sources
- Cannot push branch ' ': the push would include conflicted…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/99aeaedad2b9306f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/resolve/context.rs:168
let repo = repo.clone().for_tree_diffing()?;
// Merge without favoring a side to reproduce the actual conflicts, and
// force diff3-style markers with the sentinel labels so every hunk carries
// the common ancestor and marker lines are exactly known strings.
let mut options: gix::merge::plumbing::tree::Options = repo.tree_merge_options()?.into();
options.blob_merge.text.conflict = gix::merge::blob::builtin_driver::text::Conflict::Keep {
style: gix::merge::blob::builtin_driver::text::ConflictStyle::Diff3,
marker_size: 7.try_into().expect("non-zero constant"),
};
let mut outcome = repo.merge_trees(base, ours, theirs, merge_labels(), options.into())?;
let merged_tree_id = outcome.tree.write()?.detach();
let mut index = repo.index_from_tree(&merged_tree_id)?;
if !outcome.index_changed_after_applying_conflicts(
&mut index,
gix::merge::tree::TreatAsUnresolved::git(),
gix::merge::tree::apply_index_entries::RemovalMode::Mark,
) {
bail!(
"Re-merging the conflicting trees of commit {commit_id} yielded no conflicts to resolve"
);
}
let mut sides_by_path: std::collections::BTreeMap<BString, ConflictSides> = Default::default();
for entry in index.entries() {
use gix::index::entry::Stage;
let sides = sides_by_path
.entry(entry.path(&index).to_owned())
.or_default();
match entry.stage() {
Stage::Unconflicted => continue,
Stage::Base => sides.base = true,
Stage::Ours => sides.ours = true,
Stage::Theirs => sides.theirs = true,
}
}
sides_by_path.retain(|_, sides| sides.base || sides.ours || sides.theirs);View on GitHub (pinned to 58e5313667)