{"record":{"id":"2f45dfa006f33442","repo":"DioxusLabs/dioxus","slug":"failed-to-get-current-dir","errorCode":null,"errorMessage":"Failed to get current dir","messagePattern":"Failed to get current dir","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/rustcwrapper.rs","lineNumber":66,"sourceCode":"    std::env::var(DX_RUSTC_WRAPPER_ENV_VAR).is_ok()\n}\n\n/// Run rustc directly, but output the result to a per-crate file in the args directory.\n///\n/// <https://doc.rust-lang.org/cargo/reference/config.html#buildrustc>\npub fn run_rustc() -> ExitCode {\n    let args_dir: PathBuf = std::env::var(DX_RUSTC_WRAPPER_ENV_VAR)\n        .expect(\"DX_RUSTC env var must be set\")\n        .into();\n\n    // Cargo invokes a workspace wrapper like: `wrapper-name rustc [args...]`\n    // We skip our own executable name (`wrapper-name`) to get the args passed to us.\n    let captured_args = args().skip(1).collect::<Vec<_>>();\n\n    let rustc_args = RustcArgs {\n        args: captured_args.clone(),\n        envs: vars().collect::<_>(),\n        cwd: std::env::current_dir().expect(\"Failed to get current dir\"),\n    };\n\n    // Always persist the captured rustc invocation, even for link steps.\n    // The tip crate's bin target is typically only observed during the final link invocation,\n    // so returning early before writing would lose the exact args/envs we need for fat-link replay.\n    write_rustc_args(&args_dir, &rustc_args);\n\n    // If we are being asked to link, delegate to the linker action after capturing.\n    if has_linking_args() {\n        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","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/DioxusLabs/dioxus/blob/24f6a829df0dfa203961a98ea4cae21c2ff27e28/packages/cli/src/rustcwrapper.rs#L48-L84","documentation":"`run_rustc` reads the current working directory to record it with the captured rustc args; this panic fires if `std::env::current_dir` fails, which happens when the process's working directory has been deleted or is otherwise inaccessible.","triggerScenarios":"Thrown at packages/cli/src/rustcwrapper.rs:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the command from a directory that still exists and is accessible; recreate or cd into a valid working directory if it was deleted."],"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-14T00:17:10.932Z"}