{"record":{"id":"ae9cb002ca1750db","repo":"DioxusLabs/dioxus","slug":"input-path-should-be-valid-utf8","errorCode":null,"errorMessage":"input_path should be valid utf8","messagePattern":"input_path should be valid utf8","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/wasm_bindgen.rs","lineNumber":147,"sourceCode":"            args.push(\"--remove-producers-section\");\n        }\n\n        if self.keep_lld_exports {\n            args.push(\"--keep-lld-exports\");\n        }\n\n        // Out name\n        args.push(\"--out-name\");\n        args.push(&self.out_name);\n\n        // wbg generates typescript bindnings by default - we don't want those\n        args.push(\"--no-typescript\");\n\n        // Out dir\n        let out_dir = self\n            .out_dir\n            .to_str()\n            .expect(\"input_path should be valid utf8\");\n\n        args.push(\"--out-dir\");\n        args.push(out_dir);\n\n        // Input path\n        let input_path = self\n            .input_path\n            .to_str()\n            .expect(\"input_path should be valid utf8\");\n        args.push(input_path);\n\n        tracing::debug!(\"wasm-bindgen: {:#?}\", args);\n\n        // Run bindgen\n        let output = Command::new(binary).args(args).output().await?;\n\n        // Check for errors\n        if !output.stderr.is_empty() {","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/393d190a801ccb441d41923e232289b4f8a5c669/packages/cli/src/wasm_bindgen.rs#L129-L165","documentation":"Before invoking wasm-bindgen, dx stringifies the output directory with Path::to_str(); on this platform paths can contain non-UTF-8 bytes, to_str() returns None, and the expect panics. The message says input_path but line 147 converts out_dir - a copy-paste in the panic text.","triggerScenarios":"dx serve/dx build for web where the target/output directory path contains bytes invalid as UTF-8 - typically Windows or macOS folders or usernames with legacy encodings (latin-1, shift-jis).","commonSituations":"Non-ASCII usernames with broken normalization; projects moved from old systems with differently encoded directory names; mounted volumes exposing byte-encoded names.","solutions":["Move or clone the project to a purely ASCII, UTF-8-safe path","Point CARGO_TARGET_DIR at a short ASCII path (e.g. /tmp/dx-target or C:\\\\dx\\\\target)","Rename the offending parent directory so the full path becomes valid UTF-8"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn assert_utf8_path(p: &std::path::Path) -> anyhow::Result<&str> {\n    p.to_str().ok_or_else(|| anyhow::anyhow!(\"path is not valid UTF-8: {:?}\", p))\n}","typeGuard":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }","tryCatchPattern":null,"preventionTips":["Keep projects and build outputs under pure-ASCII paths on Windows/macOS","Set CARGO_TARGET_DIR to a short ASCII path when usernames contain non-ASCII characters","After moving/cloning projects, verify paths still decode as UTF-8"],"tags":["wasm","wasm-bindgen","path","utf8","cli","runtime"],"backgroundTag":null,"analyzedSha":"393d190a801ccb441d41923e232289b4f8a5c669","analyzedAt":"2026-08-16T11:27:45.815Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}