DioxusLabs/dioxus · error

Failed to deserialize asset. This may be caused by a mismatc

Error message

Failed to deserialize asset. This may be caused by a mismatch between your dioxus and dioxus-cli versions

What it means

The manganis macro could not deserialize the const-serialized BundledAsset from the linker section. The byte layout is tied to the dioxus-cli version that wrote it, so a mismatch between the CLI that bundled the asset and the macro/runtime reading it causes this failure.

Source

Thrown at packages/manganis/manganis/src/macro_helpers.rs:71

    input_path: &str,
    asset_config: AssetOptions,
) -> BundledAsset {
    create_bundled_asset(input_path, asset_config)
}

/// Serialize an asset to a const buffer
///
/// Serializes the asset directly (not wrapped in SymbolData) for simplicity.
/// Uses a 4096-byte buffer and pads to the full size to match linker section size.
pub const fn serialize_asset(asset: &BundledAsset) -> ConstVec<u8, 4096> {
    dx_macro_helpers::serialize_to_const_with_max_padded::<4096>(asset)
}

/// Deserialize a const buffer into a BundledAsset
pub const fn deserialize_asset(bytes: &[u8]) -> BundledAsset {
    match const_serialize::deserialize_const!(BundledAsset, bytes) {
        Some((_, asset)) => asset,
        None => panic!(
            "Failed to deserialize asset. This may be caused by a mismatch between your dioxus and dioxus-cli versions"
        ),
    }
}

pub mod dx_macro_helpers {
    use const_serialize::{ConstVec, SerializeConst};

    /// Serialize a value to a const buffer, padding to the specified size
    ///
    /// This is a generic helper that works with any type implementing `SerializeConst`.
    /// It serializes the value and then pads the buffer to the specified memory layout size.
    pub const fn serialize_to_const<T: SerializeConst>(
        value: &T,
        memory_layout_size: usize,
    ) -> ConstVec<u8> {
        let data = ConstVec::new();
        let mut data = const_serialize::serialize_const(value, data);

View on GitHub (pinned to 24f6a829df)

Solutions

  1. Asset deserialization failed, usually from a version mismatch. Align the dioxus and dioxus-cli (dx) versions and rebuild.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/manganis/manganis/src/macro_helpers.rs:71 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/c211f85067f37ffa. Report an issue: GitHub.