gitbutlerapp/gitbutler · error
Invalid parents to disconnect: SelectorSet::None is not…
Error message
Invalid parents to disconnect: SelectorSet::None is not allowed
What it means
Editor::disconnect_segment_from accepts a SelectorSet describing which parents to disconnect. SelectorSet::All means 'all', Some means a specific list, but None is not a meaningful request; unless a skip-reconnect step makes an empty set valid, None is rejected with this error.
Solutions
- Pass SelectorSet::All to disconnect all parents, or SelectorSet::Some(vec) for specific parents
- Check upstream logic so a None SelectorSet is never propagated into this call
- Set skip_reconnect_step only if you genuinely intend the no-disconnect/no-reconnect semantics
Example fix
// before editor.disconnect_segment_from(target, SelectorSet::None, children)?; // after editor.disconnect_segment_from(target, SelectorSet::All, children)?;
Defensive patterns
Strategy: validation
Validate before calling
fn valid_parents_set(s: &SelectorSet) -> bool {
!matches!(s, SelectorSet::None)
} Type guard
enum NonEmptyParents { All, Some(Vec<Selector>) }
fn to_parents(s: SelectorSet) -> Option<NonEmptyParents> {
match s { SelectorSet::None => None, other => Some(...) }
} Try / catch
match parents {
SelectorSet::None => bail!("parents_to_disconnect must be All or Some"),
_ => editor.disconnect_segment_from(target, parents, children)?,
} Prevention
- Model 'no parents' explicitly as SelectorSet::Some(vec![]), not None
- Propagate Option<SelectorSet> upstream so None never reaches this API
- Only rely on skip_reconnect_step semantics if you fully intend them
When it happens
Trigger: Calling disconnect_segment_from with parents_to_disconnect = SelectorSet::None without skip_reconnect_step set — typically passing None by mistake instead of All or Some(selectors).
Common situations: Programmatically constructing a SelectorSet where an earlier lookup produced None and it was propagated into disconnect_segment_from instead of being converted to a concrete set.
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
- 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
- argument ' ' must be a non-negative integer that fits in…
- argument ' ' must be an integer that fits in isize
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/46e8652088015a06.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-rebase/src/graph_rebase/mutate.rs:409
SelectorSet::Some(children) => Some(
children
.as_slice()
.iter()
.map(|from_child| from_child.to_selector(self))
.collect::<Result<Vec<_>>>()?
.into_iter()
.map(|selector| self.history.normalize_selector(selector))
.collect::<Result<Vec<_>>>()?,
),
};
let parents_to_disconnect = match parents_to_disconnect {
SelectorSet::All => None,
SelectorSet::None => {
if skip_reconnect_step {
Some(Vec::new())
} else {
return Err(anyhow!(
"Invalid parents to disconnect: SelectorSet::None is not allowed"
));
}
}
SelectorSet::Some(parents) => Some(
parents
.as_slice()
.iter()
.map(|from_parent| from_parent.to_selector(self))
.collect::<Result<Vec<_>>>()?
.into_iter()
.map(|selector| self.history.normalize_selector(selector))
.collect::<Result<Vec<_>>>()?,
),
};
// Edges to children.
let incoming_edges = selfView on GitHub (pinned to 58e5313667)