{"record":{"id":"2b3e6a2eaa13015b","repo":"bevyengine/bevy","slug":"dag-has-overlapping-groups-between-keys-0-and","errorCode":null,"errorMessage":"DAG has overlapping groups between keys {0:?} and {1:?}","messagePattern":"DAG has overlapping groups between keys (.+?) and (.+?)","errorType":"exception","errorClass":"DagOverlappingGroupError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/schedule/graph/dag.rs","lineNumber":724,"sourceCode":"impl<K: Debug, V: Debug, S> Debug for DagGroups<K, V, S> {\n    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {\n        f.debug_tuple(\"DagGroups\").field(&self.0).finish()\n    }\n}\n\n/// Error indicating that the graph has redundant edges.\n#[derive(Error, Debug)]\n#[error(\"DAG has redundant edges: {0:?}\")]\npub struct DagRedundancyError<N: GraphNodeId>(pub Vec<(N, N)>);\n\n/// Error indicating that two graphs both have a dependency between the same nodes.\n#[derive(Error, Debug)]\n#[error(\"DAG has a cross-dependency between nodes {0:?} and {1:?}\")]\npub struct DagCrossDependencyError<N>(pub N, pub N);\n\n/// Error indicating that the graph has overlapping groups between two keys.\n#[derive(Error, Debug)]\n#[error(\"DAG has overlapping groups between keys {0:?} and {1:?}\")]\npub struct DagOverlappingGroupError<K>(pub K, pub K);\n\n#[cfg(test)]\nmod tests {\n    use core::ops::DerefMut;\n\n    use crate::schedule::graph::{index, Dag, Direction, GraphNodeId, UnGraph};\n\n    #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]\n    struct TestNode(u32);\n\n    impl GraphNodeId for TestNode {\n        type Adjacent = (TestNode, Direction);\n        type Edge = (TestNode, TestNode);\n\n        fn kind(&self) -> &'static str {\n            \"test node\"\n        }","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/schedule/graph/dag.rs#L706-L742","documentation":"`DagOverlappingGroupError` is the low-level graph error reporting that groups keyed `{0}` and `{1}` have overlapping members while also carrying an ordering between the group keys. Bevy wraps it as `ScheduleBuildError::SetsHaveOrderButIntersect`: two ordered system sets share at least one system, so that system has no consistent position.","triggerScenarios":"The same condition as `SetsHaveOrderButIntersect` — sets A and B with `A.before(B)` (possibly transitively) and at least one system registered in both. Encountered raw when matching the inner error or using the Dag grouping API directly.","commonSituations":"Cross-cutting sets (debug/networking) collecting systems that also live in ordered phase sets; plugin composition layering multiple memberships per system; refactors adding a second `.in_set` without checking the sets are unordered relative to each other.","solutions":["Give each system a single membership among the two ordered sets","Remove the ordering between the intersecting sets, ordering specific non-shared systems instead","Factor shared systems into a third set that both original sets relate to without intersection"],"exampleFix":"// before\napp.configure_sets(Update, A.before(B));\napp.add_systems(Update, shared.in_set(A).in_set(B)); // DagOverlappingGroupError(A, B)\n\n// after\napp.configure_sets(Update, A.before(B));\napp.add_systems(Update, shared.in_set(A));","handlingStrategy":"try-catch","validationCode":"// Guard at config time: ordered sets must be disjoint\nfn safe_to_order(a: &SetMembers, b: &SetMembers) -> bool {\n    a.intersection(b).next().is_none()\n}","typeGuard":null,"tryCatchPattern":"match schedule.initialize(&mut world) {\n    Err(ScheduleBuildError::SetsHaveOrderButIntersect(err @ DagOverlappingGroupError(_, _))) => {\n        // err.0/err.1 name the two set keys; remove the shared membership or the ordering\n    }\n    other => other.map(|_| ()),\n}","preventionTips":["Assign each system one home among ordered sets; use extra sets only when unordered","Cross-cutting concerns should not be ordered against phase sets that share their members","Integration-test set ordering whenever a new cross-cutting set is introduced"],"tags":["bevy","ecs","schedule","dag","system-sets"],"backgroundTag":"conflicting-ordering-constraints","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}