bevyengine/bevy · error · ApplySceneError
Failed to apply the cached Scene (asset path: "{cached:?}"):
Error message
Failed to apply the cached Scene (asset path: "{cached:?}"): {error} What it means
Variant of ApplySceneError. When a ResolvedScene that includes a cached scene is applied, the cached scene is applied first; if that inner application fails, the failure is wrapped as CachedSceneApplyError carrying the cached scene's asset path and a boxed inner ApplySceneError. The wrapper preserves where in the layering the failure happened.
Source
Thrown at crates/bevy_scene/src/resolved_scene.rs:616
},
/// Caused when attempting to include a cached scene when a [`ResolvedScene`] already has [`Template`]s or related scenes.
#[error("Attempted to include cached scene (id {id:?}, path: {path:?}), but the resolved scene already has templates. For correctness, the cached scene should always be included first.")]
LateCached {
/// The asset id of the cached scene that was included late.
id: UntypedAssetId,
/// The path of the cached scene that was included late.
path: Option<AssetPath<'static>>,
},
}
/// An error produced when applying a [`ResolvedScene`].
#[derive(Error, Debug)]
pub enum ApplySceneError {
/// Caused when a [`Template`] fails to build
#[error("Failed to build a Template in the current Scene: {0}")]
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.View on GitHub (pinned to 396ca72708)
Solutions
- Read the inner boxed ApplySceneError — the real cause is inside `error`, not this variant
- Rebuild/re-cache the cached scene asset so it matches current component definitions
- Reproduce by applying the cached ScenePatch directly to isolate the failing layer
Defensive patterns
Strategy: try-catch
Try / catch
match result {
Err(ApplySceneError::CachedSceneApplyError { cached, error }) => {
error!("cached scene {cached:?} failed: {error}"); // recurse: error may itself be CachedSceneApplyError
}
_ => {}
} Prevention
- Re-cache scene assets whenever component definitions change
- Treat this variant as a location pointer — always debug the inner boxed error
When it happens
Trigger: Spawning/applying a scene that has an included cached scene, where the cached scene itself fails to apply (its own templates or nested related scenes fail). The inner error is produced inside the cached apply path and boxed into this variant.
Common situations: A cached scene built against an older version of the components it contains; nested cached scenes where an inner entity reference no longer resolves; corrupted or stale ScenePatch assets after a schema change.
Related errors
- Failed to apply the related {relationship_type_name} Scene a
- Cannot cache Scene function with arguments
- Attempted to include a second cached scene (id {id:?}, path:
- Attempted to include cached scene (id {id:?}, path: {path:?}
- Failed to build a Template in the current Scene: {0}
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/7ad9e3ebe64858ab.
Report an issue: GitHub.