{"record":{"id":"e57f2a97d04e43be","repo":"DioxusLabs/dioxus","slug":"failed-to-execute-rustc-command","errorCode":null,"errorMessage":"Failed to execute rustc command","messagePattern":"Failed to execute rustc command","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/rustcwrapper.rs","lineNumber":94,"sourceCode":"        return crate::link::LinkAction::from_env()\n            .expect(\"Linker action not found\")\n            .run_link();\n    }\n\n    // Run the actual rustc command.\n    // We want all stdout/stderr to be inherited, so the user sees the compiler output.\n    let mut cmd = std::process::Command::new(\"rustc\");\n\n    // The first argument in `captured_args` is the rustc path, which we need to skip\n    // when passing arguments to the `rustc` command we are spawning.\n    cmd.args(captured_args.iter().skip(1));\n    cmd.envs(rustc_args.envs);\n    cmd.current_dir(rustc_args.cwd);\n    cmd.stdout(std::process::Stdio::inherit());\n    cmd.stderr(std::process::Stdio::inherit());\n\n    // Spawn the process and propagate its exit code.\n    let status = cmd.status().expect(\"Failed to execute rustc command\");\n    std::process::exit(status.code().unwrap_or(1)); // Exit with 1 if process was killed by signal\n}\n\nfn write_rustc_args(args_dir: &PathBuf, rustc_args: &RustcArgs) {\n    // Extract the crate name from the args to use as the filename.\n    // Skip non-sensical args when a build is completely fresh (rustc is invoked with --crate-name ___)\n    let crate_name = rustc_args\n        .args\n        .iter()\n        .skip_while(|arg| *arg != \"--crate-name\")\n        .nth(1);\n\n    if let Some(crate_name) = crate_name {\n        if crate_name != \"___\" {\n            std::fs::create_dir_all(args_dir)\n                .expect(\"Failed to create args directory for rustc wrapper\");\n\n            let crate_type = rustc_args","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/rustcwrapper.rs#L76-L112","documentation":"`run_rustc` spawns the real rustc as a subprocess with inherited output; this panic fires if spawning fails (rustc not found on PATH, permission denied, etc.). It is a process-launch failure, not a compilation error — compile errors pass through rustc's own output.","triggerScenarios":"Thrown at packages/cli/src/rustcwrapper.rs:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the rustc binary referenced by DX_RUSTC exists and is executable, and inspect the wrapped command arguments for errors."],"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"}