bevyengine/bevy · error · ApplySceneError
The cached scene (id: {id:?}, path: "{path:?}") does not exi
Error message
The cached scene (id: {id:?}, path: "{path:?}") does not exist. What it means
Variant of ApplySceneError. The ResolvedScene references a cached ScenePatch by AssetId, but that asset is not present in the Assets<ScenePatch> collection at apply time — i.e. the handle exists but the asset behind it was never loaded, failed to load, or was removed.
Source
Thrown at crates/bevy_scene/src/resolved_scene.rs:624
},
}
/// 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.
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}"
)]View on GitHub (pinned to 396ca72708)
Solutions
- Check the cached ScenePatch handle's LoadState before spawning; log and skip on LoadState::Failed
- Keep the cached patch loaded (strong handle or prevent free_unused_assets from evicting it) for as long as the ResolvedScene lives
- Verify the asset path printed in the error exists and loads (inspect server.load_failed / failed ids)
Defensive patterns
Strategy: validation
Validate before calling
if !patches.contains(&cached_handle) {
// not loaded (or unloaded): wait or bail with a clear message
return Ok(());
} Try / catch
match resolved.spawn(&mut world) {
Err(SpawnSceneError::ApplySceneError(ApplySceneError::MissingCachedScene { id, path })) => {
warn!("cached scene {path:?} ({id:?}) missing — re-load before retrying");
}
_ => {}
} Prevention
- Keep strong handles to cached ScenePatches for the lifetime of scenes that include them
- Watch the AssetServer failed-loads channel to catch failed loads early
When it happens
Trigger: Applying a ResolvedScene whose included cached scene handle dangles: the ScenePatch asset was unloaded (Assets::remove / AssetServer::free_unused_assets) or its load failed before resolve.
Common situations: Holding a ResolvedScene across frames while hot-reloading or asset unloading evicts the cached patch; failed disk load of the .scn/ron asset going unnoticed; asset server configured without the scene's source directory.
Related errors
- 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 apply the cached Scene (asset path: "{cached:?}"):
- The cached scene (id: {id:?}, path: "{path:?}") has not been
AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20).
Data as JSON: /api/errors/789b367a1e34bdf1.
Report an issue: GitHub.