{"record":{"id":"e34e2283fa1c0e57","repo":"bevyengine/bevy","slug":"setnotfound","errorCode":"SetNotFound","errorMessage":"Set not found","messagePattern":"Set not found","errorType":"error_code","errorClass":"ScheduleError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/schedule/error.rs","lineNumber":289,"sourceCode":"        match self {\n            ScheduleBuildWarning::HierarchyRedundancy(DagRedundancyError(transitive_edges)) => {\n                ScheduleBuildError::hierarchy_redundancy_to_string(transitive_edges, graph)\n            }\n            ScheduleBuildWarning::Ambiguity(AmbiguousSystemConflictsWarning(ambiguities)) => {\n                ScheduleBuildError::ambiguity_to_string(ambiguities, graph, world.components())\n            }\n        }\n    }\n}\n\n/// Error returned from some `Schedule` methods\n#[derive(Error, Debug)]\npub enum ScheduleError {\n    /// Operation cannot be completed because the schedule has changed and `Schedule::initialize` needs to be called\n    #[error(\"Operation cannot be completed because the schedule has changed and `Schedule::initialize` needs to be called\")]\n    Uninitialized,\n    /// Method could not find set\n    #[error(\"Set not found\")]\n    SetNotFound,\n    /// Schedule not found\n    #[error(\"Schedule not found.\")]\n    ScheduleNotFound,\n    /// Error initializing schedule\n    #[error(\"{0}\")]\n    ScheduleBuildError(ScheduleBuildError),\n}\n\nimpl From<ScheduleBuildError> for ScheduleError {\n    fn from(value: ScheduleBuildError) -> Self {\n        Self::ScheduleBuildError(value)\n    }\n}\n","sourceCodeStart":271,"sourceCodeEnd":304,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/schedule/error.rs#L271-L304","documentation":"`ScheduleError::SetNotFound` is returned by `Schedule::systems_in_set` and the `remove_systems_in_set` family when the requested system set has no entry in that schedule — the set was never configured there and no system in that schedule references it via `.in_set`. Sets only exist in a schedule once something registers them in it.","triggerScenarios":"Calling `systems_in_set(MySet)` on a schedule where `MySet` was never configured (no `.configure_sets` call) and holds no systems; querying the right set on the wrong schedule label; removing systems from a set after the set was already removed with `RemoveSetAndSystems` policy.","commonSituations":"Assuming a plugin's set exists in every schedule; typos or using a similarly-named custom set instead of the intended one; querying before the plugin that populates the set has run; double-removal in cleanup code.","solutions":["Ensure the set exists in that schedule first: `.configure_sets(TheSchedule, MySet.run_if(...))` or add a system `.in_set(MySet)` there","Verify you fetched the intended `ScheduleLabel` — set membership never carries across schedules","Treat the `Err` as a legitimate 'empty' answer (Ok(0)/skip) in cleanup paths instead of unwrapping"],"exampleFix":"// before\nlet systems = schedule.systems_in_set(MySet).unwrap(); // Err(SetNotFound)\n\n// after\napp.configure_sets(Update, MySet); // ensure it exists in this schedule\nlet systems = schedule.systems_in_set(MySet)?;","handlingStrategy":"try-catch","validationCode":"// Confirm the set is present in that schedule before querying\nlet known = schedule.systems_in_set(MySet).is_ok(); // after initialize\n// or proactively ensure it exists:\napp.configure_sets(Update, MySet);","typeGuard":null,"tryCatchPattern":"match schedule.systems_in_set(MySet) {\n    Err(ScheduleError::SetNotFound) => Ok(vec![]), // treat as empty set\n    other => other.map(|s| s.iter().cloned().collect()),\n}","preventionTips":["Configure sets explicitly in the schedule that owns them rather than assuming plugin sets exist everywhere","Verify the ScheduleLabel type matches where the set was registered","In cleanup paths, handle SetNotFound as a benign no-op"],"tags":["bevy","ecs","schedule","system-sets","not-found"],"backgroundTag":"unknown-set-reference","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}