bevyengine/bevy · error · ApplySceneError

The cached scene (id: {id:?}, path: "{path:?}") has not been

Error message

The cached scene (id: {id:?}, path: "{path:?}") has not been resolved yet.

What it means

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).

Source

Thrown at crates/bevy_scene/src/resolved_scene.rs:632

    TemplateBuildError(BevyError),
    /// Caused when the cached [`ResolvedScene`] fails to apply a [`ResolvedScene`].
    #[error("Failed to apply the cached Scene (asset path: \"{cached:?}\"): {error}")]
    CachedSceneApplyError {
        /// The asset path of the cached scene that failed to apply.
        cached: Option<AssetPath<'static>>,
        /// The error that occurred while applying the cached scene.
        error: Box<ApplySceneError>,
    },
    /// Caused when an cached scene is not present.
    #[error("The cached scene (id: {id:?}, path: \"{path:?}\") does not exist.")]
    MissingCachedScene {
        /// The path of the cached scene.
        path: Option<AssetPath<'static>>,
        /// The asset id of the cached scene.
        id: AssetId<ScenePatch>,
    },
    /// Caused when an cached scene has not been resolved yet.
    #[error("The cached scene (id: {id:?}, path: \"{path:?}\") has not been resolved yet.")]
    UnresolvedCachedScene {
        /// The path of the cached scene.
        path: Option<AssetPath<'static>>,
        /// The asset id of the cached scene.
        id: AssetId<ScenePatch>,
    },
    /// Caused when a related [`ResolvedScene`] fails to apply.
    #[error(
        "Failed to apply the related {relationship_type_name} Scene at index {index}: {error}"
    )]
    RelatedSceneError {
        /// The type name of the relationship.
        relationship_type_name: &'static str,
        /// The index of the related scene that failed to apply.
        index: usize,
        /// The error that occurred when applying the related scene.
        error: Box<ApplySceneError>,
    },

View on GitHub (pinned to 396ca72708)

Solutions

  1. Drive resolution to completion first: run ScenePatch::resolve on the cached patch before spawning scenes that include it
  2. Switch to queue_spawn_scene, which waits for dependencies and resolution before spawning
  3. In a system, filter on the patch's resolved state being Some before spawning

Example fix

// before
let patch = ScenePatch::load(&server, my_scene);
world.spawn_scene(resolved_scene)?; // cached patch unresolved

// after
let patch = ScenePatch::load(&server, my_scene);
// wait until dependencies are loaded, then:
patch.resolve(&server, &patches)?;
world.spawn_scene(resolved_scene)?;
Defensive patterns

Strategy: retry

Validate before calling

let ready = patches
    .get(&cached_handle)
    .is_some_and(|p| p.resolved.is_some());
if !ready { /* skip this frame, retry next frame */ }

Try / catch

match resolved.spawn(&mut world) {
    Err(SpawnSceneError::ApplySceneError(ApplySceneError::UnresolvedCachedScene { id, .. })) => {
        // schedule a retry after the cached patch resolves
    }
    _ => {}
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/8a54a5ad6b204d35. Report an issue: GitHub.