{"record":{"id":"79792674d8c036d6","repo":"gitbutlerapp/gitbutler","slug":"there-has-been-a-malformed-conflicted-commit-unab","errorCode":null,"errorMessage":"There has been a malformed conflicted commit, unable to find the conflicted files","messagePattern":"There has been a malformed conflicted commit, unable to find the conflicted files","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-core/src/commit/mod.rs","lineNumber":610,"sourceCode":"    }\n}\n\n/// Conflict specific details\nimpl Commit<'_> {\n    /// Obtains the conflict entries of a conflicted commit if the commit is\n    /// conflicted, otherwise returns None.\n    pub fn conflict_entries(&self) -> anyhow::Result<Option<ConflictEntries>> {\n        let repo = self.id.repo;\n\n        if !self.is_conflicted() {\n            return Ok(None);\n        }\n\n        let tree = repo.find_tree(self.tree)?;\n        let Some(conflicted_entries_blob) =\n            tree.find_entry(TreeKind::ConflictFiles.as_tree_entry_name())\n        else {\n            bail!(\n                \"There has been a malformed conflicted commit, unable to find the conflicted files\"\n            );\n        };\n        let conflicted_entries_blob = conflicted_entries_blob.object()?.into_blob();\n        let conflicted_entries: ConflictEntries =\n            toml::from_str(&conflicted_entries_blob.data.as_bstr().to_str_lossy())?;\n\n        Ok(Some(conflicted_entries))\n    }\n}\n\n/// Represents what was causing a particular commit to conflict when rebased.\n#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialEq)]\n#[cfg_attr(feature = \"export-schema\", derive(schemars::JsonSchema))]\n#[serde(rename_all = \"camelCase\")]\npub struct ConflictEntries {\n    /// The ancestors that were conflicted\n    pub ancestor_entries: Vec<PathBuf>,","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-core/src/commit/mod.rs#L592-L628","documentation":"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.","triggerScenarios":"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.","commonSituations":"History rewritten by rebase/filter-branch dropping GitButler's metadata trees; inspecting a conflicted commit produced outside GitButler; corrupted repository after an interrupted operation.","solutions":["Recreate the conflicted commit through the GitButler workflow so the conflict-files entry is written","Verify the commit tree contains the conflict-files entry before calling conflict_entries()","Fall back to deriving conflicts from the commit's parent trees if metadata is absent","Check repository integrity (git fsck) if the commit was expected to be well-formed"],"exampleFix":"// before\nlet entries = commit.conflict_entries()?;\n// after\nlet entries = match commit.conflict_entries() {\n    Ok(e) => e,\n    Err(_) => derive_conflicts_from_parents(&repo, &commit)?,\n};","handlingStrategy":"try-catch","validationCode":"fn has_conflict_files_entry(commit: &Commit) -> bool {\n    commit.tree().map(|t| t.find_entry(TreeKind::ConflictFiles.as_tree_entry_name()).is_some()).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match commit.conflict_entries() {\n    Ok(e) => e,\n    Err(_) => derive_conflicts_from_parents(&repo, &commit),\n}","preventionTips":["Create conflicted commits only via the GitButler workflow","Run git fsck after suspicious repository states","Don't rewrite GitButler conflicted commits with external tools","Version-check metadata conventions before reading old histories"],"tags":["git","conflicts","corrupt-commit"],"backgroundTag":"schema-validation-failed","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"}