bevyengine/bevy · error · SpawnSceneError

This scene has not been resolved yet and cannot be spawned.

Error message

This scene has not been resolved yet and cannot be spawned. It is likely waiting for dependencies to load

What it means

Variant of SpawnSceneError returned by ScenePatch::spawn/apply (and the scene-list equivalents). The patch's `resolved` field is still None, meaning ScenePatch::resolve has not completed — typically because the scene or its dependencies are still loading. The scene cannot be spawned until resolution finishes.

Source

Thrown at crates/bevy_scene/src/scene_patch.rs:104

        resolved
            .apply(entity, &mut BundleScratch::default())
            .map_err(SpawnSceneError::ApplySceneError)
    }
}

/// An [`Error`] that occurs during scene spawning.
#[derive(Error, Debug)]
pub enum SpawnSceneError {
    /// Failed to apply a [`ResolvedScene`].
    ///
    /// [`ResolvedScene`]: crate::ResolvedScene
    #[error(transparent)]
    ApplySceneError(#[from] ApplySceneError),
    #[error(transparent)]
    /// Calling [`Scene::resolve`] failed.
    ResolveSceneError(#[from] ResolveSceneError),
    /// Attempted to spawn a scene that has not been resolved yet.
    #[error("This scene has not been resolved yet and cannot be spawned. It is likely waiting for dependencies to load")]
    UnresolvedSceneError,
}

/// A component that, when added, will queue applying the given [`ScenePatch`] after the scene and its dependencies have been loaded and resolved.
#[derive(Component, FromTemplate, Deref, DerefMut)]
pub struct ScenePatchInstance(pub Handle<ScenePatch>);

/// An [`Asset`] that holds a [`SceneList`], tracks its dependencies, and holds a [`ResolvedSceneListRoot`] (after the [`SceneList`] has been loaded and resolved)
#[derive(Asset, TypePath)]
pub struct SceneListPatch {
    /// A [`SceneList`].
    pub scene_list: Option<Box<dyn SceneList>>,

    /// The dependencies of `scene_list` (populated using [`SceneList::register_dependencies`]). These are "asset dependencies" and will affect the load state.
    #[dependency]
    pub dependencies: Vec<UntypedHandle>,

    /// The [`ResolvedSceneListRoot`], if exists. This is populated after the scene list and its dependencies have been loaded and resolved.

View on GitHub (pinned to 396ca72708)

Solutions

  1. Use world.queue_spawn_scene / queue_spawn_scene_list which defer spawning until load + resolve complete
  2. Gate spawning on the patch's resolved state: check patch.resolved.is_some() in your system
  3. In tests, advance app.update()/asset server until recursively_dependencies_loaded is true before spawning

Example fix

// before
let patch = ScenePatch::load(&server, scene);
let entity = patch.spawn(&mut world)?; // UnresolvedSceneError

// after
let handle = world.queue_spawn_scene(scene); // spawns automatically once resolved
Defensive patterns

Strategy: validation

Validate before calling

if patch.resolved.is_some() {
    let entity = patch.spawn(&mut world)?;
} else {
    // not resolved yet: wait, or use queue_spawn_scene
}

Try / catch

match patch.spawn(&mut world) {
    Err(SpawnSceneError::UnresolvedSceneError) => { /* wait for load+resolve, retry */ }
    r => r?,
}

Prevention

When it happens

Trigger: Calling patch.spawn(&mut world) or patch.apply(entity) in the same frame the ScenePatch was created/loaded, before dependencies finish loading and resolve runs; the .ok_or(UnresolvedSceneError) on the resolved Option triggers.

Common situations: Startup systems that spawn a scene immediately after requesting it; level streaming code that assumes loads are synchronous; tests that forget to pump the asset server.

Related errors


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