bevyengine/bevy · error · LoadDirectError

Attempted to load an asset with an empty path "{0}"

Error message

Attempted to load an asset with an empty path "{0}"

What it means

LoadDirectError::EmptyPath: a nested/async asset load was attempted with an asset path whose path component is empty. There is no file to load, so the load builder rejects it immediately rather than issuing a meaningless read.

Source

Thrown at crates/bevy_asset/src/loader.rs:346

impl<A: Asset> AssetContainer for A {
    fn insert(self: Box<Self>, index: AssetIndex, world: &mut World) {
        // We only ever call this if we know the asset is still alive, so it is fine to unwrap here.
        world
            .resource_mut::<Assets<A>>()
            .insert(index, *self)
            .expect("the AssetIndex is still valid");
    }

    fn asset_type_name(&self) -> &'static str {
        core::any::type_name::<A>()
    }
}

/// An error that occurs when attempting an async load using [`NestedLoadBuilder`].
#[derive(Error, Debug)]
pub enum LoadDirectError {
    /// The asset path was empty.
    #[error("Attempted to load an asset with an empty path \"{0}\"")]
    EmptyPath(AssetPath<'static>),
    /// Loading an asset path with a subasset at the end is unsupported. See issue [#18291].
    ///
    /// [#18291]: https://github.com/bevyengine/bevy/issues/18291
    #[error("Requested to load an asset path ({0:?}) with a subasset, but this is unsupported. See issue #18291")]
    RequestedSubasset(AssetPath<'static>),
    /// A general [`AssetLoadError`] for an asset dependency.
    #[error("Failed to load dependency {dependency:?} {error}")]
    LoadError {
        /// Which dependency failed.
        dependency: AssetPath<'static>,
        /// The original error for that dependency.
        error: Box<AssetLoadError>,
    },
}

/// An error that occurs while deserializing [`AssetMeta`].
#[derive(Error, Debug, Clone, PartialEq, Eq)]

View on GitHub (pinned to 396ca72708)

Solutions

  1. Check how the AssetPath was constructed; a label-only or source-only string still needs a real path
  2. Default or compute a concrete file path before initiating the load
  3. Guard against empty path strings at the call site when paths come from data
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/bevy_asset/src/loader.rs:346 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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