{"record":{"id":"6dd727c0ab0e39dd","repo":"bevyengine/bevy","slug":"requested-resource-does-not-exist-in-the-world","errorCode":null,"errorMessage":"Requested resource {} does not exist in the `World`.\n                Did you forget to add it using `app.insert_resource` / `app.init_resource`?\n                Resources are also implicitly added via `app.add_message`,\n                and can be added by plugins.","messagePattern":"Requested resource (.+?) does not exist in the `World`\\.\n                Did you forget to add it using `app\\.insert_resource` / `app\\.init_resource`\\?\n                Resources are also implicitly added via `app\\.add_message`,\n                and can be added by plugins\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_ecs/src/world/deferred_world.rs","lineNumber":466,"sourceCode":"        &mut self,\n        state: &'s mut QueryState<D, F>,\n    ) -> Query<'_, 's, D, F> {\n        // SAFETY: We have mutable access to the entire world\n        unsafe { state.query_unchecked(self.world) }\n    }\n\n    /// Gets a mutable reference to the resource of the given type\n    ///\n    /// # Panics\n    ///\n    /// Panics if the resource does not exist.\n    /// Use [`get_resource_mut`](DeferredWorld::get_resource_mut) instead if you want to handle this case.\n    #[inline]\n    #[track_caller]\n    pub fn resource_mut<R: Resource<Mutability = Mutable>>(&mut self) -> Mut<'_, R> {\n        match self.get_resource_mut() {\n            Some(x) => x,\n            None => panic!(\n                \"Requested resource {} does not exist in the `World`.\n                Did you forget to add it using `app.insert_resource` / `app.init_resource`?\n                Resources are also implicitly added via `app.add_message`,\n                and can be added by plugins.\",\n                DebugName::type_name::<R>()\n            ),\n        }\n    }\n\n    /// Gets a mutable reference to the resource of the given type if it exists\n    #[inline]\n    pub fn get_resource_mut<R: Resource<Mutability = Mutable>>(&mut self) -> Option<Mut<'_, R>> {\n        // SAFETY: &mut self ensure that there are no outstanding accesses to the resource\n        unsafe { self.world.get_resource_mut() }\n    }\n\n    /// Gets a mutable reference to the non-send data of the given type, if it exists.\n    ///","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_ecs/src/world/deferred_world.rs#L448-L484","documentation":"Error \"Requested resource {} does not exist in the `World`.\n                Did you forget to add it using `app.insert_resource` / `app.init_resource`?\n                Resources are also implicitly added via `app.add_message`,\n                and can be added by plugins.\" thrown in bevyengine/bevy.","triggerScenarios":"Thrown at crates/bevy_ecs/src/world/deferred_world.rs:466 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the resource first: app.insert_resource(...) / app.init_resource::<R>()","Use get_resource_mut().expect(...) or match on Option to control the failure yourself","Use get_resource_or_insert_with to lazily create it"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}