{"record":{"id":"0d6af1d9f8f62556","repo":"DioxusLabs/dioxus","slug":"failed-to-deserialize-asset-make-sure-you-built-w","errorCode":null,"errorMessage":"Failed to deserialize asset. Make sure you built with the matching version of the Dioxus CLI","messagePattern":"Failed to deserialize asset\\. Make sure you built with the matching version of the Dioxus CLI","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/manganis/manganis-core/src/asset.rs","lineNumber":152,"sourceCode":"        // Read the slice using volatile reads to prevent the compiler from optimizing\n        // away the read at compile time\n        let bundled = (self.bundled)();\n        let ptr = bundled as *const [u8] as *const u8;\n        let len = bundled.len();\n        if ptr.is_null() {\n            panic!(\n                \"Tried to use an asset that was not bundled. Make sure you are compiling dx as the linker\"\n            );\n        }\n        let mut bytes = Vec::with_capacity(len);\n        for byte in 0..len {\n            // SAFETY: We checked that the pointer was not null above. The pointer is valid for reads and\n            // since we are reading a u8 there are no alignment requirements\n            let byte = unsafe { std::ptr::read_volatile(ptr.add(byte)) };\n            bytes.push(byte);\n        }\n\n        deserialize_const!(BundledAsset, bytes.as_slice()).expect(\"Failed to deserialize asset. Make sure you built with the matching version of the Dioxus CLI\").1\n    }\n\n    /// Return a canonicalized path to the asset\n    ///\n    /// Attempts to resolve it against an `assets` folder in the current directory.\n    /// If that doesn't exist, it will resolve against the cargo manifest dir\n    pub fn resolve(&self) -> PathBuf {\n        #[cfg(feature = \"dioxus\")]\n        // If the asset is relative, we resolve the asset at the current directory\n        if !dioxus_core_types::is_bundled_app() {\n            return PathBuf::from(self.bundled().absolute_source_path.as_str());\n        }\n\n        #[cfg(feature = \"dioxus\")]\n        let bundle_root = {\n            let base_path = dioxus_cli_config::base_path();\n            let base_path = base_path\n                .as_deref()","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/manganis/manganis-core/src/asset.rs#L134-L170","documentation":"asset!() metadata is serialized by the dx CLI into linker symbols at bundle time. BundledAsset::bundled() reads those raw bytes and runs deserialize_const!, which validates the serialized shape against the manganis-core version compiled into your app. When the CLI that bundled the assets and the library that reads them disagree on the serialization format, deserialization returns Err and this expect panics.","triggerScenarios":"Calling .bundled()/.resolve() on an asset at runtime when the app was bundled by a dx CLI from a different release than the dioxus/manganis crates compiled into the binary; incremental builds that preserved old linker symbols across an upgrade.","commonSituations":"Upgrading dioxus crates but not dx (or vice versa); switching between stable and nightly dx builds; stale target/ directory after a version bump.","solutions":["Update dx and the dioxus/manganis dependencies to the same release together","cargo clean and rebuild so assets are re-bundled by the matching CLI","Compare dx --version against the dioxus version in Cargo.lock and reconcile them","If pinned to an old CLI, pin the matching dioxus crate versions in Cargo.toml"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"#[test]\nfn toolchain_versions_match() {\n    let lock = std::fs::read_to_string(\"Cargo.lock\").unwrap();\n    assert!(lock.contains(\"name = \\\"dioxus\\\"\"));\n    // compare against `dx --version` in CI to keep dx and crates in lockstep\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upgrade dx and the dioxus/manganis crates together, in the same change","Run cargo clean after any dioxus version bump","Verify dx --version matches the dioxus release in Cargo.lock before shipping","Never mix artifacts bundled by an older dx into a newer build"],"tags":["manganis","assets","version-mismatch","cli","build","panic"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}