bevyengine/bevy · error · UntypedAssetConversionError

This UntypedHandle is for {found:?} and cannot be converted

Error message

This UntypedHandle is for {found:?} and cannot be converted into a Handle<{expected:?}>

What it means

UntypedAssetConversionError: an attempt was made to convert an UntypedHandle into a Handle<A> whose asset type does not match the type the untyped handle was created for. The error carries the found and expected type names to identify the mismatch.

Source

Thrown at crates/bevy_asset/src/handle.rs:725

    ($uuid:expr) => {{
        $crate::Handle::Uuid($crate::uuid::uuid!($uuid), ::core::marker::PhantomData)
    }};
}

#[deprecated = "Use uuid_handle! instead"]
#[macro_export]
macro_rules! weak_handle {
    ($uuid:expr) => {
        $crate::uuid_handle!($uuid)
    };
}

/// Errors preventing the conversion of to/from an [`UntypedHandle`] and a [`Handle`].
#[derive(Error, Debug, PartialEq, Clone)]
#[non_exhaustive]
pub enum UntypedAssetConversionError {
    /// Caused when trying to convert an [`UntypedHandle`] into a [`Handle`] of the wrong type.
    #[error(
        "This UntypedHandle is for {found:?} and cannot be converted into a Handle<{expected:?}>"
    )]
    TypeIdMismatch {
        /// The expected [`TypeId`] of the [`Handle`] being converted to.
        expected: TypeId,
        /// The [`TypeId`] of the [`UntypedHandle`] being converted from.
        found: TypeId,
    },
}

#[cfg(test)]
mod tests {
    use alloc::boxed::Box;
    use bevy_platform::hash::FixedHasher;
    use bevy_reflect::{FromReflect, PartialReflect};
    use core::hash::BuildHasher;
    use uuid::Uuid;

View on GitHub (pinned to 396ca72708)

Solutions

  1. Convert to the correct Handle<A> matching the untyped handle's actual asset type (shown as `found` in the error)
  2. Match on the asset's type id or use the loader's known output type before converting
  3. Handle the Err case of try_typed-like conversions instead of assuming the type
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/bevy_asset/src/handle.rs:725 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/ffc4c4deb149efdf. Report an issue: GitHub.