{"record":{"id":"09f11bce4c81d8bb","repo":"jdx/mise","slug":"cmd-exe-cannot-use-a-unc-path-as-a-working-directory-working","errorCode":null,"errorMessage":"cmd.exe cannot use a UNC path as a working directory\n\n  working directory: {dir}\n\nIt would start in C:\\Windows instead and run the command there, so mise stops rather\nthan running it somewhere you did not ask for.\n\nUse a shell that accepts UNC paths, either for this task:\n\n  shell = \"pwsh -c\"\n\nor for every task:\n\n  mise settings windows_default_inline_shell_args=\"pwsh -c\"\n\nA file task takes its shell from windows_default_file_shell_args instead.","messagePattern":"cmd\\.exe cannot use a UNC path as a working directory\n\n  working directory: (.+?)\n\nIt would start in C:\\\\Windows instead and run the command there, so mise stops rather\nthan running it somewhere you did not ask for\\.\n\nUse a shell that accepts UNC paths, either for this task:\n\n  shell = \"pwsh -c\"\n\nor for every task:\n\n  mise settings windows_default_inline_shell_args=\"pwsh -c\"\n\nA file task takes its shell from windows_default_file_shell_args instead\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_executor.rs","lineNumber":1441,"sourceCode":"        let mut inputs = Vec::with_capacity(cache.command_inputs.len());\n        for command in &cache.command_inputs {\n            if command.trim().is_empty() {\n                eyre::bail!(\n                    \"task {} cache command input must not be empty: {command:?}\",\n                    task.name\n                );\n            }\n            let (program, args, cmd_verbatim) =\n                self.get_cmd_program_and_args(command, task, &[])?;\n            // The same refusal as in `exec_program`, and it matters more here: these commands feed\n            // the cache key, so running them from C:\\Windows would hash the wrong directory's\n            // answer. Measured on 2026.8.6 with the project on a UNC share — a `command_inputs`\n            // entry reading a file that exists in the project fails, while the same config on a\n            // local path succeeds. `--dry-run` does not reach here (see the cache branch in\n            // `run_task`), so there is nothing to exempt.\n            #[cfg(windows)]\n            if cmd_shell_cannot_use_dir(&program, &root) {\n                eyre::bail!(\"{}\", unc_working_dir_error(&root));\n            }\n            #[cfg(not(windows))]\n            let _ = cmd_verbatim;\n            let program = program.to_executable();\n            #[cfg(windows)]\n            let program = crate::path::resolve_posix_shell_program_path(&program, &filtered_env)\n                .unwrap_or(program);\n            let runner = CmdLineRunner::new(program);\n            #[cfg(windows)]\n            let runner = if cmd_verbatim {\n                args.iter().fold(runner, |runner, arg| runner.raw_arg(arg))\n            } else {\n                runner.args(&args)\n            };\n            #[cfg(not(windows))]\n            let runner = runner.args(&args);\n            let mut runner = runner\n                .current_dir(&root)","sourceCodeStart":1423,"sourceCodeEnd":1459,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_executor.rs#L1423-L1459","documentation":"Error \"cmd.exe cannot use a UNC path as a working directory\n\n  working directory: {dir}\n\nIt would start in C:\\Windows instead and run the command there, so mise stops rather\nthan running it somewhere you did not ask for.\n\nUse a shell that accepts UNC paths, either for this task:\n\n  shell = \"pwsh -c\"\n\nor for every task:\n\n  mise settings windows_default_inline_shell_args=\"pwsh -c\"\n\nA file task takes its shell from windows_default_file_shell_args instead.\" thrown in jdx/mise.","triggerScenarios":"Thrown at src/task/task_executor.rs:1441 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set `shell = \"pwsh -c\"` (or another UNC-capable shell) on the task","Globally set `mise settings windows_default_inline_shell_args=\"pwsh -c\"`","For file tasks, set windows_default_file_shell_args instead","Map the UNC path to a drive letter and run from there"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}