{"record":{"id":"71dcabb75f3b7aa1","repo":"gitbutlerapp/gitbutler","slug":"cannot-currently-handle-more-than-1-parent","errorCode":null,"errorMessage":"cannot currently handle more than 1 parent","messagePattern":"cannot currently handle more than 1 parent","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/commit_engine/mod.rs","lineNumber":148,"sourceCode":"        Destination::NewCommit {\n            parent_commit_id: None,\n            ..\n        } => Vec::new(),\n        Destination::NewCommit {\n            parent_commit_id: Some(parent),\n            ..\n        } => vec![*parent],\n        Destination::AmendCommit { commit_id, .. } => commit_id\n            .attach(repo)\n            .object()?\n            .peel_to_commit()?\n            .parent_ids()\n            .map(|id| id.detach())\n            .collect(),\n    };\n\n    if !matches!(destination, Destination::AmendCommit { .. }) && parents.len() > 1 {\n        bail!(\"cannot currently handle more than 1 parent\")\n    }\n\n    let target_tree = match &destination {\n        Destination::NewCommit {\n            parent_commit_id: None,\n            ..\n        } => gix::ObjectId::empty_tree(repo.object_hash()),\n        Destination::NewCommit {\n            parent_commit_id: Some(base_commit),\n            ..\n        }\n        | Destination::AmendCommit {\n            commit_id: base_commit,\n            ..\n        } => but_core::Commit::from_id(base_commit.attach(repo))?\n            .tree_id_or_auto_resolution()?\n            .detach(),\n    };","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/commit_engine/mod.rs#L130-L166","documentation":"create_commit supports at most one parent commit unless the destination is an amend operation, which legitimately inherits a commit's parents. Creating a new commit with more than one parent (a merge) is not implemented, so the function bails to avoid silently dropping merge semantics.","triggerScenarios":"Calling create_commit with Destination::NewCommit (or a non-Amend destination) when the reference commit has 2+ parents — i.e. attempting to create a child of a merge commit.","commonSituations":"Building commits on top of merge commits in the workspace; automation that naively uses HEAD (a merge commit) as the parent; operations triggered while the workspace head is a merge.","solutions":["Amend the merge commit instead (Destination::AmendCommit), which supports multi-parent","Create the new commit without inheriting the merge parents, or rebase the workspace to remove the merge first","Wait for/ask for merge-commit support in create_commit; do not work around by crafting raw git commits inconsistently with workspace state"],"exampleFix":"// before\nbut.create_commit(Destination::NewCommit { parent_commit_id: Some(merge_commit) }, ...); // bails\n// after\nbut.create_commit(Destination::AmendCommit { commit_id: merge_commit }, ...);","handlingStrategy":"validation","validationCode":"let parents = commit.parent_ids().count();\nif parents > 1 && !matches!(destination, Destination::AmendCommit { .. }) {\n    // use amend or avoid the merge commit as parent\n}","typeGuard":"fn supports_destination(destination: &Destination, parent_count: usize) -> bool {\n    parent_count <= 1 || matches!(destination, Destination::AmendCommit { .. })\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"more than 1 parent\") => {\n        // fall back to Destination::AmendCommit on the merge commit\n    }\n    other => other?,\n}","preventionTips":["Detect merge commits (2+ parents) before choosing a destination","Use amend semantics for merge commits","Avoid basing new workspace commits on merge commits"],"tags":["git","merge","unsupported"],"backgroundTag":"unsupported-operation","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"}