{"record":{"id":"7ef6122f8350778e","repo":"DioxusLabs/dioxus","slug":"failed-to-create-args-directory-for-rustc-wrapper","errorCode":null,"errorMessage":"Failed to create args directory for rustc wrapper","messagePattern":"Failed to create args directory for rustc wrapper","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/rustcwrapper.rs","lineNumber":110,"sourceCode":"\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\n                .args\n                .iter()\n                .skip_while(|arg| *arg != \"--crate-type\")\n                .nth(1)\n                .map(|s| s.as_str());\n\n            let serialized_args =\n                serde_json::to_string(rustc_args).expect(\"Failed to serialize rustc args\");\n\n            // Write args with an explicit target suffix: {crate_name}.lib.json or\n            // {crate_name}.bin.json. This avoids the ambiguity of a bare {crate_name}.json\n            // and ensures lib+bin crates don't overwrite each other.\n            let suffix = match crate_type {\n                Some(\"lib\" | \"rlib\") => \"lib\",\n                Some(\"bin\") => \"bin\",\n                _ => \"bin\", // proc-macro, cdylib, etc. — treat as bin","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/rustcwrapper.rs#L92-L128","documentation":"`write_rustc_args` creates the args directory (provided via `DX_RUSTC`) before writing per-crate arg files; this panic fires if directory creation fails due to permissions, an invalid path, or the path existing as a file.","triggerScenarios":"Thrown at packages/cli/src/rustcwrapper.rs:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions and available disk space for the directory the rustc wrapper uses to store args; create the parent directory manually if needed."],"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"}