gitbutlerapp/gitbutler · error
Invalid parent delimitation: requested child is not a…
Error message
Invalid parent delimitation: requested child is not a direct parent of target.child
What it means
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.
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
Example fix
// before editor.disconnect_segment_from(target, parents, SelectorSet::Some(vec![deep_descendant]))?; // after let direct: HashSet<_> = target.child.children(); let kids = requested.into_iter().filter(|s| direct.contains(&s.id)).collect(); editor.disconnect_segment_from(target, parents, SelectorSet::Some(kids))?;
Defensive patterns
Strategy: validation
Validate before calling
fn children_are_direct(children: &[Selector], available: &HashSet<gix::ObjectId>) -> bool {
children.iter().all(|c| available.contains(&c.id))
} Try / catch
let unknown: Vec<_> = children.iter().filter(|c| !available_children.contains(&c.id)).collect();
anyhow::ensure!(unknown.is_empty(), "children not directly connected: {unknown:?}");
editor.disconnect_segment_from(target, parents, SelectorSet::Some(children))?; Prevention
- 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
When it happens
Trigger: 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.
Common situations: Long-running rebase scripts accumulating child selectors across edits, or conflating 'descendants' with 'direct children' when computing what to disconnect.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Invalid parent delimitation: requested parent is not a…
- A matching parent can't be found in the output graph
- A parent in the output graph is not a pick
- An edge with desired order
- Cannot order selected commits by parentage: selected commit
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/1386dec7a36c1ade.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-rebase/src/graph_rebase/mutate.rs:464
.iter()
.map(|(_, _, edge_source)| *edge_source)
.collect::<HashSet<_>>();
// 1. Verify that all parents and children to disconnect are directly connected to the target segment.
if let Some(parents_to_disconnect) = parents_to_disconnect.as_ref() {
for selector in parents_to_disconnect {
if !available_parents.contains(&selector.id) {
return Err(anyhow!(
"Invalid parent delimitation: requested parent is not a direct parent of target.parent"
));
}
}
}
if let Some(children_to_disconnect) = children_to_disconnect.as_ref() {
for selector in children_to_disconnect {
if !available_children.contains(&selector.id) {
return Err(anyhow!(
"Invalid parent delimitation: requested child is not a direct parent of target.child"
));
}
}
}
let parent_ids_to_disconnect = parents_to_disconnect
.as_ref()
.map(|parents| parents.iter().map(|s| s.id).collect::<HashSet<_>>());
let child_ids_to_disconnect = children_to_disconnect
.as_ref()
.map(|children| children.iter().map(|s| s.id).collect::<HashSet<_>>());
let mut disconnected_parent_edges = Vec::new();
// 2. Disconnect parents.
for (edge_id, edge_weight, edge_target) in outgoing_edges {
let should_disconnect = parent_ids_to_disconnect
.as_ref()View on GitHub (pinned to 58e5313667)