{"record":{"id":"54fcd0b959aa2595","repo":"DioxusLabs/dioxus","slug":"failed-to-read-input-file","errorCode":null,"errorMessage":"failed to read input file","messagePattern":"failed to read input file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/wasm-split/wasm-split-cli/src/main.rs","lineNumber":42,"sourceCode":"    /// Validate the main module of a wasm module\n    #[clap(name = \"validate\")]\n    Validate(ValidateArgs),\n}\n\n#[derive(Parser)]\nstruct SplitArgs {\n    /// The wasm module emitted by rustc\n    original: PathBuf,\n\n    /// The wasm module emitted by wasm-bindgen\n    bindgened: PathBuf,\n\n    /// The output *directory* to write the split wasm files to\n    out_dir: PathBuf,\n}\n\nfn split(args: SplitArgs) {\n    let original = std::fs::read(&args.original).expect(\"failed to read input file\");\n    let bindgened = std::fs::read(&args.bindgened).expect(\"failed to read input file\");\n\n    _ = std::fs::remove_dir_all(&args.out_dir);\n    std::fs::create_dir_all(&args.out_dir).expect(\"failed to create output dir\");\n\n    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","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/wasm-split/wasm-split-cli/src/main.rs#L24-L60","documentation":"The wasm-split CLI entry point reads the two wasm files passed as arguments (original and bindgened) with std::fs::read and expects success. A missing, unreadable, or mistyped path aborts with this panic before any splitting starts.","triggerScenarios":"Invoking wasm-split-cli split with a wrong path, a file that hasn't been produced yet (the rustc/wasm-bindgen steps haven't run), permission problems, or relative paths resolved from the wrong working directory.","commonSituations":"Manual CLI invocation with typos or relative paths; CI steps racing ahead of the wasm-bindgen step; missing artifacts after a clean; running the CLI from a different directory than assumed.","solutions":["Check both paths exist before running (list the target directory)","Use absolute paths or run the command from the directory the relative paths are based on","Ensure the rustc and wasm-bindgen steps producing these files completed first","Fix file permissions/ownership in CI"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn inputs_readable(paths: &[&Path]) -> bool {\n    paths.iter().all(|p| p.is_file() && std::fs::metadata(p).is_ok())\n}\nassert!(inputs_readable(&[&args.original, &args.bindgened]));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths when invoking wasm-split-cli from scripts or CI","Ensure the rustc and wasm-bindgen steps finish before the split step runs","Check the target directory contents before invoking the CLI","Verify file permissions in CI containers"],"tags":["wasm-split","cli","io","build","file-not-found"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}