{"record":{"id":"46e8652088015a06","repo":"gitbutlerapp/gitbutler","slug":"invalid-parents-to-disconnect-selectorset-none-i","errorCode":null,"errorMessage":"Invalid parents to disconnect: SelectorSet::None is not allowed","messagePattern":"Invalid parents to disconnect: SelectorSet::None is not allowed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-rebase/src/graph_rebase/mutate.rs","lineNumber":409,"sourceCode":"            SelectorSet::Some(children) => Some(\n                children\n                    .as_slice()\n                    .iter()\n                    .map(|from_child| from_child.to_selector(self))\n                    .collect::<Result<Vec<_>>>()?\n                    .into_iter()\n                    .map(|selector| self.history.normalize_selector(selector))\n                    .collect::<Result<Vec<_>>>()?,\n            ),\n        };\n\n        let parents_to_disconnect = match parents_to_disconnect {\n            SelectorSet::All => None,\n            SelectorSet::None => {\n                if skip_reconnect_step {\n                    Some(Vec::new())\n                } else {\n                    return Err(anyhow!(\n                        \"Invalid parents to disconnect: SelectorSet::None is not allowed\"\n                    ));\n                }\n            }\n            SelectorSet::Some(parents) => Some(\n                parents\n                    .as_slice()\n                    .iter()\n                    .map(|from_parent| from_parent.to_selector(self))\n                    .collect::<Result<Vec<_>>>()?\n                    .into_iter()\n                    .map(|selector| self.history.normalize_selector(selector))\n                    .collect::<Result<Vec<_>>>()?,\n            ),\n        };\n\n        // Edges to children.\n        let incoming_edges = self","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-rebase/src/graph_rebase/mutate.rs#L391-L427","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\neditor.disconnect_segment_from(target, SelectorSet::None, children)?;\n// after\neditor.disconnect_segment_from(target, SelectorSet::All, children)?;","handlingStrategy":"validation","validationCode":"fn valid_parents_set(s: &SelectorSet) -> bool {\n    !matches!(s, SelectorSet::None)\n}","typeGuard":"enum NonEmptyParents { All, Some(Vec<Selector>) }\nfn to_parents(s: SelectorSet) -> Option<NonEmptyParents> {\n    match s { SelectorSet::None => None, other => Some(...) }\n}","tryCatchPattern":"match parents {\n    SelectorSet::None => bail!(\"parents_to_disconnect must be All or Some\"),\n    _ => editor.disconnect_segment_from(target, parents, children)?,\n}","preventionTips":["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"],"tags":["rebase","invalid-argument","selectors"],"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"}