{"record":{"id":"1386dec7a36c1ade","repo":"gitbutlerapp/gitbutler","slug":"invalid-parent-delimitation-requested-child-is-no","errorCode":null,"errorMessage":"Invalid parent delimitation: requested child is not a direct parent of target.child","messagePattern":"Invalid parent delimitation: requested child is not a direct parent of target\\.child","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-rebase/src/graph_rebase/mutate.rs","lineNumber":464,"sourceCode":"            .iter()\n            .map(|(_, _, edge_source)| *edge_source)\n            .collect::<HashSet<_>>();\n\n        // 1. Verify that all parents and children to disconnect are directly connected to the target segment.\n        if let Some(parents_to_disconnect) = parents_to_disconnect.as_ref() {\n            for selector in parents_to_disconnect {\n                if !available_parents.contains(&selector.id) {\n                    return Err(anyhow!(\n                        \"Invalid parent delimitation: requested parent is not a direct parent of target.parent\"\n                    ));\n                }\n            }\n        }\n\n        if let Some(children_to_disconnect) = children_to_disconnect.as_ref() {\n            for selector in children_to_disconnect {\n                if !available_children.contains(&selector.id) {\n                    return Err(anyhow!(\n                        \"Invalid parent delimitation: requested child is not a direct parent of target.child\"\n                    ));\n                }\n            }\n        }\n\n        let parent_ids_to_disconnect = parents_to_disconnect\n            .as_ref()\n            .map(|parents| parents.iter().map(|s| s.id).collect::<HashSet<_>>());\n        let child_ids_to_disconnect = children_to_disconnect\n            .as_ref()\n            .map(|children| children.iter().map(|s| s.id).collect::<HashSet<_>>());\n\n        let mut disconnected_parent_edges = Vec::new();\n        // 2. Disconnect parents.\n        for (edge_id, edge_weight, edge_target) in outgoing_edges {\n            let should_disconnect = parent_ids_to_disconnect\n                .as_ref()","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-rebase/src/graph_rebase/mutate.rs#L446-L482","documentation":"disconnect_segment_from also validates that every requested child selector is directly connected to the target's child (target.child). This error is thrown when a supplied child selector's commit is not a direct parent-connected node of target.child — despite the message wording, the check is against available_children.","triggerScenarios":"Calling disconnect_segment_from with children_to_disconnect containing a Selector whose id is not a direct child of the target segment — e.g. a descendant two steps down, or a stale selector invalidated by earlier mutations.","commonSituations":"Long-running rebase scripts accumulating child selectors across edits, or conflating 'descendants' with 'direct children' when computing what to disconnect.","solutions":["Derive children_to_disconnect from the target's actual direct children only","Validate each child selector against the target's direct children before the call","Re-resolve selectors after prior mutations to avoid stale ids"],"exampleFix":"// before\neditor.disconnect_segment_from(target, parents, SelectorSet::Some(vec![deep_descendant]))?;\n// after\nlet direct: HashSet<_> = target.child.children();\nlet kids = requested.into_iter().filter(|s| direct.contains(&s.id)).collect();\neditor.disconnect_segment_from(target, parents, SelectorSet::Some(kids))?;","handlingStrategy":"validation","validationCode":"fn children_are_direct(children: &[Selector], available: &HashSet<gix::ObjectId>) -> bool {\n    children.iter().all(|c| available.contains(&c.id))\n}","typeGuard":null,"tryCatchPattern":"let unknown: Vec<_> = children.iter().filter(|c| !available_children.contains(&c.id)).collect();\nanyhow::ensure!(unknown.is_empty(), \"children not directly connected: {unknown:?}\");\neditor.disconnect_segment_from(target, parents, SelectorSet::Some(children))?;","preventionTips":["Only select direct children of target.child, not arbitrary descendants","Refresh selectors after prior mutations in multi-step edits","Write a preflight assertion comparing requested vs available ids"],"tags":["rebase","validation","graph"],"backgroundTag":"invalid-argument-value","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"}