gitbutlerapp/gitbutler · error

There has been a malformed conflicted commit, unable to…

Error message

There has been a malformed conflicted commit, unable to find the conflicted files

What it means

conflict_entries() reads the special conflict-files tree entry that GitButler writes into conflicted commits. When the commit is flagged as conflicted but that entry is missing, the commit is malformed and the function bails instead of returning partial data.

Solutions

  1. Recreate the conflicted commit through the GitButler workflow so the conflict-files entry is written
  2. Verify the commit tree contains the conflict-files entry before calling conflict_entries()
  3. Fall back to deriving conflicts from the commit's parent trees if metadata is absent
  4. Check repository integrity (git fsck) if the commit was expected to be well-formed

Example fix

// before
let entries = commit.conflict_entries()?;
// after
let entries = match commit.conflict_entries() {
    Ok(e) => e,
    Err(_) => derive_conflicts_from_parents(&repo, &commit)?,
};
Defensive patterns

Strategy: try-catch

Validate before calling

fn has_conflict_files_entry(commit: &Commit) -> bool {
    commit.tree().map(|t| t.find_entry(TreeKind::ConflictFiles.as_tree_entry_name()).is_some()).unwrap_or(false)
}

Try / catch

match commit.conflict_entries() {
    Ok(e) => e,
    Err(_) => derive_conflicts_from_parents(&repo, &commit),
}

Prevention

When it happens

Trigger: Reading conflict entries from a commit whose tree lacks the expected conflict-files entry — e.g. a hand-crafted or externally rewritten conflicted commit, a truncated/amended tree, or a commit created by an older/incompatible tool version.

Common situations: History rewritten by rebase/filter-branch dropping GitButler's metadata trees; inspecting a conflicted commit produced outside GitButler; corrupted repository after an interrupted operation.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/79792674d8c036d6. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-core/src/commit/mod.rs:610

    }
}

/// Conflict specific details
impl Commit<'_> {
    /// Obtains the conflict entries of a conflicted commit if the commit is
    /// conflicted, otherwise returns None.
    pub fn conflict_entries(&self) -> anyhow::Result<Option<ConflictEntries>> {
        let repo = self.id.repo;

        if !self.is_conflicted() {
            return Ok(None);
        }

        let tree = repo.find_tree(self.tree)?;
        let Some(conflicted_entries_blob) =
            tree.find_entry(TreeKind::ConflictFiles.as_tree_entry_name())
        else {
            bail!(
                "There has been a malformed conflicted commit, unable to find the conflicted files"
            );
        };
        let conflicted_entries_blob = conflicted_entries_blob.object()?.into_blob();
        let conflicted_entries: ConflictEntries =
            toml::from_str(&conflicted_entries_blob.data.as_bstr().to_str_lossy())?;

        Ok(Some(conflicted_entries))
    }
}

/// Represents what was causing a particular commit to conflict when rebased.
#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]
#[cfg_attr(feature = "export-schema", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase")]
pub struct ConflictEntries {
    /// The ancestors that were conflicted
    pub ancestor_entries: Vec<PathBuf>,

View on GitHub (pinned to 58e5313667)