jdx/mise · error

cmd.exe cannot use a UNC path as a working directory …

Error message

cmd.exe cannot use a UNC path as a working directory

  working directory: {dir}

It would start in C:\Windows instead and run the command there, so mise stops rather
than running it somewhere you did not ask for.

Use a shell that accepts UNC paths, either for this task:

  shell = "pwsh -c"

or for every task:

  mise settings windows_default_inline_shell_args="pwsh -c"

A file task takes its shell from windows_default_file_shell_args instead.

What it means

Error "cmd.exe cannot use a UNC path as a working directory working directory: {dir} It would start in C:\Windows instead and run the command there, so mise stops rather than running it somewhere you did not ask for. Use a shell that accepts UNC paths, either for this task: shell = "pwsh -c" or for every task: mise settings windows_default_inline_shell_args="pwsh -c" A file task takes its shell from windows_default_file_shell_args instead." thrown in jdx/mise.

Solutions

  1. Set `shell = "pwsh -c"` (or another UNC-capable shell) on the task
  2. Globally set `mise settings windows_default_inline_shell_args="pwsh -c"`
  3. For file tasks, set windows_default_file_shell_args instead
  4. Map the UNC path to a drive letter and run from there
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/task/task_executor.rs:1441 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/09f11bce4c81d8bb. Report an issue: GitHub.

Appendix: source

Thrown at src/task/task_executor.rs:1441

        let mut inputs = Vec::with_capacity(cache.command_inputs.len());
        for command in &cache.command_inputs {
            if command.trim().is_empty() {
                eyre::bail!(
                    "task {} cache command input must not be empty: {command:?}",
                    task.name
                );
            }
            let (program, args, cmd_verbatim) =
                self.get_cmd_program_and_args(command, task, &[])?;
            // The same refusal as in `exec_program`, and it matters more here: these commands feed
            // the cache key, so running them from C:\Windows would hash the wrong directory's
            // answer. Measured on 2026.8.6 with the project on a UNC share — a `command_inputs`
            // entry reading a file that exists in the project fails, while the same config on a
            // local path succeeds. `--dry-run` does not reach here (see the cache branch in
            // `run_task`), so there is nothing to exempt.
            #[cfg(windows)]
            if cmd_shell_cannot_use_dir(&program, &root) {
                eyre::bail!("{}", unc_working_dir_error(&root));
            }
            #[cfg(not(windows))]
            let _ = cmd_verbatim;
            let program = program.to_executable();
            #[cfg(windows)]
            let program = crate::path::resolve_posix_shell_program_path(&program, &filtered_env)
                .unwrap_or(program);
            let runner = CmdLineRunner::new(program);
            #[cfg(windows)]
            let runner = if cmd_verbatim {
                args.iter().fold(runner, |runner, arg| runner.raw_arg(arg))
            } else {
                runner.args(&args)
            };
            #[cfg(not(windows))]
            let runner = runner.args(&args);
            let mut runner = runner
                .current_dir(&root)

View on GitHub (pinned to 533346cc37)