{"record":{"id":"196d25fcd1e88c4e","repo":"DioxusLabs/dioxus","slug":"failed-to-write-js-module","errorCode":null,"errorMessage":"failed to write js module","messagePattern":"failed to write js module","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wasm-split/wasm-split-cli/src/main.rs","lineNumber":66,"sourceCode":"    tracing::info!(\"Building split module\");\n\n    let module = wasm_split_cli::Splitter::new(&original, &bindgened).unwrap();\n\n    let mut chunks = module.emit().unwrap();\n\n    // Write out the main module\n    tracing::info!(\n        \"Writing main module to {}\",\n        args.out_dir.join(\"main.wasm\").display()\n    );\n    std::fs::write(args.out_dir.join(\"main.wasm\"), &chunks.main.bytes).unwrap();\n\n    // Write the js module\n    std::fs::write(\n        args.out_dir.join(\"__wasm_split.js\"),\n        emit_js(&chunks.chunks, &chunks.modules),\n    )\n    .expect(\"failed to write js module\");\n\n    for (idx, chunk) in chunks.chunks.iter().enumerate() {\n        tracing::info!(\n            \"Writing chunk {} to {}\",\n            idx,\n            args.out_dir\n                .join(format!(\"chunk_{}_{}.wasm\", idx, chunk.module_name))\n                .display()\n        );\n        std::fs::write(\n            args.out_dir\n                .join(format!(\"chunk_{}_{}.wasm\", idx, chunk.module_name)),\n            &chunk.bytes,\n        )\n        .expect(\"failed to write chunk\");\n    }\n\n    for (idx, module) in chunks.modules.iter_mut().enumerate() {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/wasm-split/wasm-split-cli/src/main.rs#L48-L84","documentation":"`split` writes the generated JavaScript loader module to `__wasm_split.js` in the output directory and `expect`s the write to succeed. This panic fires on IO failure — permissions, full disk, or the output directory being removed mid-write.","triggerScenarios":"Thrown at packages/wasm-split/wasm-split-cli/src/main.rs:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the output directory is writable and has free disk space so the JS module can be written."],"exampleFix":null,"handlingStrategy":"fallback","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-23T08:17:48.524Z"}