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

  1. Pass SelectorSet::All to disconnect all parents, or SelectorSet::Some(vec) for specific parents
  2. Check upstream logic so a None SelectorSet is never propagated into this call
  3. 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

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


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 = self

View on GitHub (pinned to 58e5313667)