{"record":{"id":"8a54a5ad6b204d35","repo":"bevyengine/bevy","slug":"the-cached-scene-id-id-path-path-ha","errorCode":null,"errorMessage":"The cached scene (id: {id:?}, path: \"{path:?}\") has not been resolved yet.","messagePattern":"The cached scene \\(id: (.+?), path: \"(.+?)\"\\) has not been resolved yet\\.","errorType":"exception","errorClass":"ApplySceneError","httpStatus":null,"severity":"error","filePath":"crates/bevy_scene/src/resolved_scene.rs","lineNumber":632,"sourceCode":"    TemplateBuildError(BevyError),\n    /// Caused when the cached [`ResolvedScene`] fails to apply a [`ResolvedScene`].\n    #[error(\"Failed to apply the cached Scene (asset path: \\\"{cached:?}\\\"): {error}\")]\n    CachedSceneApplyError {\n        /// The asset path of the cached scene that failed to apply.\n        cached: Option<AssetPath<'static>>,\n        /// The error that occurred while applying the cached scene.\n        error: Box<ApplySceneError>,\n    },\n    /// Caused when an cached scene is not present.\n    #[error(\"The cached scene (id: {id:?}, path: \\\"{path:?}\\\") does not exist.\")]\n    MissingCachedScene {\n        /// The path of the cached scene.\n        path: Option<AssetPath<'static>>,\n        /// The asset id of the cached scene.\n        id: AssetId<ScenePatch>,\n    },\n    /// Caused when an cached scene has not been resolved yet.\n    #[error(\"The cached scene (id: {id:?}, path: \\\"{path:?}\\\") has not been resolved yet.\")]\n    UnresolvedCachedScene {\n        /// The path of the cached scene.\n        path: Option<AssetPath<'static>>,\n        /// The asset id of the cached scene.\n        id: AssetId<ScenePatch>,\n    },\n    /// Caused when a related [`ResolvedScene`] fails to apply.\n    #[error(\n        \"Failed to apply the related {relationship_type_name} Scene at index {index}: {error}\"\n    )]\n    RelatedSceneError {\n        /// The type name of the relationship.\n        relationship_type_name: &'static str,\n        /// The index of the related scene that failed to apply.\n        index: usize,\n        /// The error that occurred when applying the related scene.\n        error: Box<ApplySceneError>,\n    },","sourceCodeStart":614,"sourceCodeEnd":650,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_scene/src/resolved_scene.rs#L614-L650","documentation":"Variant of ApplySceneError. The cached ScenePatch asset is present, but its own `resolved` field is still None — the patch has not gone through ScenePatch::resolve yet. Applying a scene whose cached layer is unresolved is rejected with UnresolvedCachedScene (id + path included).","triggerScenarios":"Spawning/applying a ResolvedScene in the same frame the cached ScenePatch was loaded, before the system that calls ScenePatch::resolve has run; or a resolve path that skips the cached patch.","commonSituations":"Custom spawn systems that don't respect the load-then-resolve-then-spawn ordering; race between dependency loading and spawn during scene streaming; tests that spawn immediately after load.","solutions":["Drive resolution to completion first: run ScenePatch::resolve on the cached patch before spawning scenes that include it","Switch to queue_spawn_scene, which waits for dependencies and resolution before spawning","In a system, filter on the patch's resolved state being Some before spawning"],"exampleFix":"// before\nlet patch = ScenePatch::load(&server, my_scene);\nworld.spawn_scene(resolved_scene)?; // cached patch unresolved\n\n// after\nlet patch = ScenePatch::load(&server, my_scene);\n// wait until dependencies are loaded, then:\npatch.resolve(&server, &patches)?;\nworld.spawn_scene(resolved_scene)?;","handlingStrategy":"retry","validationCode":"let ready = patches\n    .get(&cached_handle)\n    .is_some_and(|p| p.resolved.is_some());\nif !ready { /* skip this frame, retry next frame */ }","typeGuard":null,"tryCatchPattern":"match resolved.spawn(&mut world) {\n    Err(SpawnSceneError::ApplySceneError(ApplySceneError::UnresolvedCachedScene { id, .. })) => {\n        // schedule a retry after the cached patch resolves\n    }\n    _ => {}\n}","preventionTips":["Enforce load -> resolve -> spawn ordering in all custom scene systems","Prefer queue_spawn_scene, which handles the ordering for you"],"tags":["bevy","scene","caching","async","load-state"],"backgroundTag":"asset-not-yet-loaded","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"}