DioxusLabs/dioxus · error

failed to create output dir

Error message

failed to create output dir

What it means

`split` clears and recreates the output directory with `create_dir_all` and `expect`s success. This panic fires when the output directory cannot be created — permissions, path conflicts (e.g. out_dir exists as a file), or an invalid path.

Solutions

  1. Verify the output directory path is valid and the process has permission to create it.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/wasm-split/wasm-split-cli/src/main.rs:46 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/c4db7f75715de3b9. Report an issue: GitHub.

Appendix: source

Thrown at packages/wasm-split/wasm-split-cli/src/main.rs:46

#[derive(Parser)]
struct SplitArgs {
    /// The wasm module emitted by rustc
    original: PathBuf,

    /// The wasm module emitted by wasm-bindgen
    bindgened: PathBuf,

    /// The output *directory* to write the split wasm files to
    out_dir: PathBuf,
}

fn split(args: SplitArgs) {
    let original = std::fs::read(&args.original).expect("failed to read input file");
    let bindgened = std::fs::read(&args.bindgened).expect("failed to read input file");

    _ = std::fs::remove_dir_all(&args.out_dir);
    std::fs::create_dir_all(&args.out_dir).expect("failed to create output dir");

    tracing::info!("Building split module");

    let module = wasm_split_cli::Splitter::new(&original, &bindgened).unwrap();

    let mut chunks = module.emit().unwrap();

    // Write out the main module
    tracing::info!(
        "Writing main module to {}",
        args.out_dir.join("main.wasm").display()
    );
    std::fs::write(args.out_dir.join("main.wasm"), &chunks.main.bytes).unwrap();

    // Write the js module
    std::fs::write(
        args.out_dir.join("__wasm_split.js"),
        emit_js(&chunks.chunks, &chunks.modules),

View on GitHub (pinned to 24f6a829df)