{"record":{"id":"c211f85067f37ffa","repo":"DioxusLabs/dioxus","slug":"failed-to-deserialize-asset-this-may-be-caused-by","errorCode":null,"errorMessage":"Failed to deserialize asset. This may be caused by a mismatch between your dioxus and dioxus-cli versions","messagePattern":"Failed to deserialize asset\\. This may be caused by a mismatch between your dioxus and dioxus-cli versions","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/manganis/manganis/src/macro_helpers.rs","lineNumber":71,"sourceCode":"    input_path: &str,\n    asset_config: AssetOptions,\n) -> BundledAsset {\n    create_bundled_asset(input_path, asset_config)\n}\n\n/// Serialize an asset to a const buffer\n///\n/// Serializes the asset directly (not wrapped in SymbolData) for simplicity.\n/// Uses a 4096-byte buffer and pads to the full size to match linker section size.\npub const fn serialize_asset(asset: &BundledAsset) -> ConstVec<u8, 4096> {\n    dx_macro_helpers::serialize_to_const_with_max_padded::<4096>(asset)\n}\n\n/// Deserialize a const buffer into a BundledAsset\npub const fn deserialize_asset(bytes: &[u8]) -> BundledAsset {\n    match const_serialize::deserialize_const!(BundledAsset, bytes) {\n        Some((_, asset)) => asset,\n        None => panic!(\n            \"Failed to deserialize asset. This may be caused by a mismatch between your dioxus and dioxus-cli versions\"\n        ),\n    }\n}\n\npub mod dx_macro_helpers {\n    use const_serialize::{ConstVec, SerializeConst};\n\n    /// Serialize a value to a const buffer, padding to the specified size\n    ///\n    /// This is a generic helper that works with any type implementing `SerializeConst`.\n    /// It serializes the value and then pads the buffer to the specified memory layout size.\n    pub const fn serialize_to_const<T: SerializeConst>(\n        value: &T,\n        memory_layout_size: usize,\n    ) -> ConstVec<u8> {\n        let data = ConstVec::new();\n        let mut data = const_serialize::serialize_const(value, data);","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/manganis/manganis/src/macro_helpers.rs#L53-L89","documentation":"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.","triggerScenarios":"Thrown at packages/manganis/manganis/src/macro_helpers.rs:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Asset deserialization failed, usually from a version mismatch. Align the dioxus and dioxus-cli (dx) versions and rebuild."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"24f6a829df0dfa203961a98ea4cae21c2ff27e28","analyzedAt":"2026-08-23T07:10:14.078Z","contentChangedAt":"2026-08-23T07:10:14.078Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}