gitbutlerapp/gitbutler · error
Validation
Validation
Error message
Commit {commit_id} is not conflicted What it means
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.
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
Example fix
// before
resolve_commit(commit_id_of_clean_parent)
// after
let conflicted = list_conflicted_commits();
if conflicted.contains(&commit_id) { resolve_commit(commit_id) } Defensive patterns
Strategy: validation
Validate before calling
const conflicted = await listConflictedCommits(); if (!conflicted.includes(commitId)) throw new Error('commit is not conflicted'); Try / catch
try { await buildRequest(commitId); } catch (e) { if (String(e).includes('is not conflicted')) { /* skip resolution flow */ } else { throw e; } } Prevention
- Check conflicted-commit list before invoking resolution APIs
- Refresh workspace state after external git operations
- Guard against stale commit ids in UI state
When it happens
Trigger: Calling build_request (public resolve API) with a commit_id whose commit.conflicted_tree_ids() returns None — i.e. a normal, non-conflicted commit.
Common situations: 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.
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
- Conflict of " " was addressed more than once
- " " has conflict , but conflict was addressed
- Re-merging the conflicting trees of commit
- The resolution for " " contains a conflict marker ( )
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/5b82c1be647c7a22.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-api/src/resolve/context.rs:134
}
#[cfg(feature = "export-schema")]
but_schemars::register_sdk_type!(ManualConflict);
/// Re-merge the conflict trees of `commit_id` and extract all conflict hunks.
///
/// Conflicts with no marker block to splice a resolution into — side deletions,
/// non-blob entries, binary or oversized files — are reported in `manual`
/// rather than failing the request, so the rest of the commit stays workable.
pub fn build_request(
repo: &gix::Repository,
commit_id: gix::ObjectId,
) -> anyhow::Result<ResolutionRequest> {
use gix::prelude::ObjectIdExt as _;
let commit = but_core::Commit::from_id(commit_id.attach(repo))?;
let Some((base, ours, theirs)) = commit.conflicted_tree_ids()? else {
bail!(
anyhow::anyhow!(Code::Validation)
.context(format!("Commit {commit_id} is not conflicted"))
);
};
let commit_message = but_core::commit::strip_conflict_markers(commit.message.as_ref())
.to_str_lossy()
.into_owned();
let parent_message = commit
.parents
.first()
.and_then(|parent_id| but_core::Commit::from_id(parent_id.attach(repo)).ok())
.map(|parent| commit_title(&parent));
let (base, ours, theirs) = (base.detach(), ours.detach(), theirs.detach());
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 carriesView on GitHub (pinned to 58e5313667)