{"record":{"id":"657cbe23017b0f45","repo":"bevyengine/bevy","slug":"uninitialized","errorCode":"Uninitialized","errorMessage":"Tried to run a schedule before all of its systems have been initialized.","messagePattern":"Tried to run a schedule before all of its systems have been initialized\\.","errorType":"error_code","errorClass":"ScheduleBuildError","httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/schedule/error.rs","lineNumber":42,"sourceCode":"    #[error(\"Failed to topologically sort the hierarchy of system sets: {0}\")]\n    HierarchySort(DiGraphToposortError<NodeId>),\n    /// Tried to topologically sort the dependency graph.\n    #[error(\"Failed to topologically sort the dependency graph: {0}\")]\n    DependencySort(DiGraphToposortError<NodeId>),\n    /// Tried to topologically sort the flattened dependency graph.\n    #[error(\"Failed to topologically sort the flattened dependency graph: {0}\")]\n    FlatDependencySort(DiGraphToposortError<SystemKey>),\n    /// Tried to order a system (set) relative to a system set it belongs to.\n    #[error(\"`{:?}` and `{:?}` have both `in_set` and `before`-`after` relationships (these might be transitive). This combination is unsolvable as a system cannot run before or after a set it belongs to.\", .0.0, .0.1)]\n    CrossDependency(#[from] DagCrossDependencyError<NodeId>),\n    /// Tried to order system sets that share systems.\n    #[error(\"`{:?}` and `{:?}` have a `before`-`after` relationship (which may be transitive) but share systems.\", .0.0, .0.1)]\n    SetsHaveOrderButIntersect(#[from] DagOverlappingGroupError<SystemSetKey>),\n    /// Tried to order a system (set) relative to all instances of some system function.\n    #[error(transparent)]\n    SystemTypeSetAmbiguity(#[from] SystemTypeSetAmbiguityError),\n    /// Tried to run a schedule before all of its systems have been initialized.\n    #[error(\"Tried to run a schedule before all of its systems have been initialized.\")]\n    Uninitialized,\n    /// A warning that was elevated to an error.\n    #[error(transparent)]\n    Elevated(#[from] ScheduleBuildWarning),\n}\n\n/// Category of warnings encountered during [`Schedule::initialize`](crate::schedule::Schedule::initialize).\n#[non_exhaustive]\n#[derive(Error, Debug)]\npub enum ScheduleBuildWarning {\n    /// The hierarchy of system sets contains redundant edges.\n    ///\n    /// This warning is **enabled** by default, but can be disabled by setting\n    /// [`ScheduleBuildSettings::hierarchy_detection`] to [`LogLevel::Ignore`]\n    /// or upgraded to a [`ScheduleBuildError`] by setting it to [`LogLevel::Error`].\n    ///\n    /// [`ScheduleBuildSettings::hierarchy_detection`]: crate::schedule::ScheduleBuildSettings::hierarchy_detection\n    /// [`LogLevel::Ignore`]: crate::schedule::LogLevel::Ignore","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/schedule/error.rs#L24-L60","documentation":"`ScheduleBuildError::Uninitialized` is returned from the internal schedule-update step when the system/set stores are not fully initialized — in practice this means the schedule graph changed (systems or sets added/removed) and a previous `Schedule::initialize` did not complete, often because it failed on an earlier build error, leaving a half-built schedule. Initialization must run to completion before the executable schedule can be updated.","triggerScenarios":"A first `initialize` fails on a build error (cycle, cross-dependency), you fix the config, and re-trigger schedule internals while the graph is still marked stale; mutating a schedule mid-initialization; manually calling schedule plumbing without going through `Schedule::initialize`.","commonSituations":"Test harnesses that call schedule internals after an intentionally-broken build; app code that adds systems inside `Startup`/plugins while a schedule build previously failed; hot-reload-style schedules mutated at runtime between initialize passes.","solutions":["Let the normal path rebuild the schedule: run `world.run_schedule(label)` or the app — `Schedule::initialize` is invoked automatically and rebuilds from the current graph","When calling `schedule.initialize(world)` manually, handle the `Result` and fix the first reported build error so initialization completes instead of leaving partial state","Avoid mutating a schedule (add_systems / remove_systems_in_set) while its build has failed or its systems are being iterated"],"exampleFix":"// before\nlet _ = schedule.initialize(&mut world); // earlier error ignored, state half-built\nrun_schedule_internals(&schedule); // ScheduleBuildError::Uninitialized\n\n// after\nschedule.initialize(&mut world)?; // propagate and fix the root build error first","handlingStrategy":"try-catch","validationCode":"// Always propagate initialization errors instead of continuing with a half-built schedule\nschedule.initialize(&mut world)?; // ? propagates; fix the root build error before further ops","typeGuard":null,"tryCatchPattern":"match schedule.initialize(&mut world) {\n    Err(ScheduleBuildError::Uninitialized) => {\n        // previous build failed partway: fix prior errors, then re-run initialize to completion\n    }\n    Err(other) => return Err(other.into()),\n    Ok(_) => {}\n}","preventionTips":["Never ignore the Result of initialize; a failed build leaves stale state","Re-run initialization to completion after any schedule mutation in runtime-editing scenarios","Prefer the app/run path, which initializes schedules atomically before execution"],"tags":["bevy","ecs","schedule","initialization","lifecycle"],"backgroundTag":"requires-reinitialization","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}