{"record":{"id":"b6f70b558d39a474","repo":"bevyengine/bevy","slug":"dag-has-redundant-edges-0","errorCode":null,"errorMessage":"DAG has redundant edges: {0:?}","messagePattern":"DAG has redundant edges: (.+?)","errorType":"exception","errorClass":"DagRedundancyError","httpStatus":null,"severity":"warning","filePath":"crates/bevy_ecs/src/schedule/graph/dag.rs","lineNumber":714,"sourceCode":"\nimpl<K, V, S> Default for DagGroups<K, V, S>\nwhere\n    S: BuildHasher + Default,\n{\n    fn default() -> Self {\n        Self(Default::default())\n    }\n}\n\nimpl<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","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/schedule/graph/dag.rs#L696-L732","documentation":"`DagRedundancyError` is the low-level graph error carrying the list of redundant edges as `(N, N)` pairs — edges whose target is already reachable through a longer path. Bevy's schedule builder surfaces it wrapped as `ScheduleBuildWarning::HierarchyRedundancy` when checking the system-set hierarchy; the Vec contents tell you exactly which containment edges to delete.","triggerScenarios":"Building a schedule whose set hierarchy declares an edge that transitive `in_set` chains already imply — the same condition that produces `HierarchyRedundancy`; you see this raw type when matching on the warning's inner error or in lower-level Dag APIs.","commonSituations":"Plugins re-declaring nesting that another plugin already established; copy-pasted configure_sets blocks; refactors that shorten one hierarchy path while leaving the old shortcut edge.","solutions":["Read the `(from, to)` pairs in the error and delete the matching direct `.in_set` edge(s)","Declare each containment relationship in exactly one place (the set's owning plugin)","If intentional, downgrade the check via `ScheduleBuildSettings::hierarchy_detection = LogLevel::Ignore`"],"exampleFix":"// before\napp.configure_sets(Update, (A, B.in_set(A), C.in_set(B).in_set(A)));\n// DagRedundancyError([(C, A)]) wrapped in HierarchyRedundancy\n\n// after\napp.configure_sets(Update, (A, B.in_set(A), C.in_set(B)));","handlingStrategy":"fallback","validationCode":"// Inspect hierarchy edges for redundancy before initialize by walking your own set-config model\n// (Bevy surfaces it post-hoc); or pre-configure tolerance:\nsettings.hierarchy_detection = LogLevel::Ignore;","typeGuard":null,"tryCatchPattern":"match schedule.initialize(&mut world) {\n    Err(ScheduleBuildError::Elevated(ScheduleBuildWarning::HierarchyRedundancy(DagRedundancyError(edges)))) => {\n        // edges: Vec<(NodeId, NodeId)> — delete the corresponding direct .in_set declarations\n    }\n    _ => {}\n}","preventionTips":["Declare nesting once per relationship","Keep hierarchy declarations colocated with set definitions","Escalate to LogLevel::Error in CI so redundant edges never accumulate silently"],"tags":["bevy","ecs","schedule","dag","redundancy"],"backgroundTag":"redundant-dependency-declaration","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}