DioxusLabs/dioxus · error

Tried to use an asset that was not bundled. Make sure you ar

Error message

Tried to use an asset that was not bundled. Make sure you are compiling dx as the linker

What it means

An asset!() symbol was resolved at runtime but no bundled asset data was linked into the binary — the linker section the CLI patches is absent. This happens when the program was built with cargo/rustc directly instead of dx acting as the linker, so the asset was never bundled.

Source

Thrown at packages/manganis/manganis-core/src/asset.rs:140

unsafe impl Sync for Asset {}

impl Asset {
    #[doc(hidden)]
    /// This should only be called from the macro
    /// Create a new asset from the bundled form of the asset and the link section
    pub const fn new(bundled: extern "Rust" fn() -> &'static [u8]) -> Self {
        Self { bundled }
    }

    /// Get the bundled asset
    pub fn bundled(&self) -> BundledAsset {
        // Read the slice using volatile reads to prevent the compiler from optimizing
        // away the read at compile time
        let bundled = (self.bundled)();
        let ptr = bundled as *const [u8] as *const u8;
        let len = bundled.len();
        if ptr.is_null() {
            panic!(
                "Tried to use an asset that was not bundled. Make sure you are compiling dx as the linker"
            );
        }
        let mut bytes = Vec::with_capacity(len);
        for byte in 0..len {
            // SAFETY: We checked that the pointer was not null above. The pointer is valid for reads and
            // since we are reading a u8 there are no alignment requirements
            let byte = unsafe { std::ptr::read_volatile(ptr.add(byte)) };
            bytes.push(byte);
        }

        deserialize_const!(BundledAsset, bytes.as_slice()).expect("Failed to deserialize asset. Make sure you built with the matching version of the Dioxus CLI").1
    }

    /// Return a canonicalized path to the asset
    ///
    /// Attempts to resolve it against an `assets` folder in the current directory.
    /// If that doesn't exist, it will resolve against the cargo manifest dir

View on GitHub (pinned to 24f6a829df)

Solutions

  1. The asset was not bundled because dx was not the linker. Build with dx build or dx serve instead of plain cargo build so assets are collected.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/manganis/manganis-core/src/asset.rs:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/299872a390e43ab6. Report an issue: GitHub.