{"record":{"id":"299872a390e43ab6","repo":"DioxusLabs/dioxus","slug":"tried-to-use-an-asset-that-was-not-bundled-make-s","errorCode":null,"errorMessage":"Tried to use an asset that was not bundled. Make sure you are compiling dx as the linker","messagePattern":"Tried to use an asset that was not bundled\\. Make sure you are compiling dx as the linker","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/manganis/manganis-core/src/asset.rs","lineNumber":140,"sourceCode":"unsafe impl Sync for Asset {}\n\nimpl Asset {\n    #[doc(hidden)]\n    /// This should only be called from the macro\n    /// Create a new asset from the bundled form of the asset and the link section\n    pub const fn new(bundled: extern \"Rust\" fn() -> &'static [u8]) -> Self {\n        Self { bundled }\n    }\n\n    /// Get the bundled asset\n    pub fn bundled(&self) -> BundledAsset {\n        // 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","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/manganis/manganis-core/src/asset.rs#L122-L158","documentation":"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.","triggerScenarios":"Thrown at packages/manganis/manganis-core/src/asset.rs:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["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."],"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-14T00:17:10.932Z"}