DioxusLabs/dioxus · error

failed to read input file

Error message

failed to read input file

What it means

`split` reads the original rustc-emitted wasm module from disk and `expect`s the read to succeed. This panic fires when the input file path is wrong, the file is missing, or it is unreadable — the failing path is the `original`/`bindgened` argument being read.

Solutions

  1. Verify the input wasm file path exists and is readable by the wasm-split CLI.
Defensive patterns

Strategy: fallback

When it happens

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

Appendix: source

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

    /// Validate the main module of a wasm module
    #[clap(name = "validate")]
    Validate(ValidateArgs),
}

#[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();

View on GitHub (pinned to 24f6a829df)