{"record":{"id":"a656337b8c9449b9","repo":"bevyengine/bevy","slug":"cannot-resolve-scene-because-the-asset-dependency","errorCode":null,"errorMessage":"Cannot resolve scene because the asset dependency {0} is not present. This could be because it isn't loaded yet, or because the asset does not exist. Consider using `queue_spawn_scene()` if you would like to wait for scene dependencies before spawning.","messagePattern":"Cannot resolve scene because the asset dependency (.+?) is not present\\. This could be because it isn't loaded yet, or because the asset does not exist\\. Consider using `queue_spawn_scene\\(\\)` if you would like to wait for scene dependencies before spawning\\.","errorType":"exception","errorClass":"ResolveSceneError","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/src/scene.rs","lineNumber":158,"sourceCode":"    /// Iterates the current dependencies.\n    pub fn iter(&self) -> impl Iterator<Item = &SceneDependency> {\n        self.0.iter()\n    }\n}\n\n/// An asset dependency of a [`Scene`].\npub struct SceneDependency {\n    /// The path of the asset.\n    pub path: AssetPath<'static>,\n    /// The type of the asset.\n    pub type_id: TypeId,\n}\n\n/// An [`Error`] that occurs during [`Scene::resolve`].\n#[derive(Error, Debug)]\npub enum ResolveSceneError {\n    /// Caused when a dependency listed in [`Scene::register_dependencies`] is not available when calling [`Scene::resolve`]\n    #[error(\"Cannot resolve scene because the asset dependency {0} is not present. This could be because it isn't loaded yet, or because the asset does not exist. Consider using `queue_spawn_scene()` if you would like to wait for scene dependencies before spawning.\")]\n    MissingSceneDependency(AssetPath<'static>),\n    /// Caused when including a cached scene during [`Scene::resolve`] fails.\n    #[error(transparent)]\n    CachedSceneError(#[from] CachedSceneError),\n    /// Caused when a [`Scene`]/[`SceneList`] is not present on the scene asset.\n    #[error(\"The Scene/SceneList is not present on the scene asset. This is likely because the scene has already been resolved, which consumed the source scene\")]\n    MissingScene,\n}\n\n/// Context used by [`Scene`] implementations during [`Scene::resolve`].\npub struct ResolveContext<'a> {\n    /// The current asset server\n    pub assets: &'a AssetServer,\n    /// The current [`ScenePatch`] asset collection\n    pub patches: &'a Assets<ScenePatch>,\n    /// The currently cached [`ScenePatch`], if there is one.\n    pub cached: Option<&'a ScenePatch>,\n}","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_scene/src/scene.rs#L140-L176","documentation":"Variant of ResolveSceneError returned by Scene::resolve. The scene declared an asset dependency in Scene::register_dependencies, but the corresponding asset is not available from the AssetServer at resolve time — either still loading, or genuinely missing. The message points at queue_spawn_scene as the wait-aware alternative.","triggerScenarios":"Calling scene.resolve(...) (or ScenePatch::resolve) in the same frame the dependency was requested, before LoadState reaches Loaded; or referencing an asset path that does not exist on disk, so it never will load.","commonSituations":"Custom systems that resolve immediately after load without checking load state; typos in asset paths used inside BSN (':\"scenes/level.scn\"'); moving/renaming asset files without updating scene sources.","solutions":["Use queue_spawn_scene instead of immediate spawn/resolve — it waits for dependencies","Gate resolution on asset_server.recursively_dependencies_loaded(&handle) returning true","Check the failing AssetPath in the error for typos or missing files, and fix the path in the scene source"],"exampleFix":"// before\nlet patch = ScenePatch::load(&server, scene);\npatch.resolve(&server, &patches)?; // MissingSceneDependency\n\n// after\nlet handle = server.add(ScenePatch::load(&server, scene));\nif server.recursively_dependencies_loaded(&handle) {\n    patches.get_mut(&handle).unwrap().resolve(&server, &patches)?;\n} else {\n    world.queue_spawn_scene(handle);\n}","handlingStrategy":"validation","validationCode":"if !server.recursively_dependencies_loaded(&handle) {\n    world.queue_spawn_scene(handle);\n    return Ok(());\n}\n// safe to resolve now","typeGuard":null,"tryCatchPattern":"match patch.resolve(&server, &patches) {\n    Err(ResolveSceneError::MissingSceneDependency(path)) => {\n        // retry next frame or report the missing path\n    }\n    r => r?,\n}","preventionTips":["Default to queue_spawn_scene instead of manual resolve+spawn","Lint asset paths referenced in BSN at build time to catch typos before runtime"],"tags":["bevy","scene","asset","async","dependency"],"backgroundTag":"missing-asset-dependency","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}