jdx/mise · error

cannot write native task stub launchers: mise-shim.exe was n

Error message

cannot write native task stub launchers: mise-shim.exe was not found next to this mise or on PATH. It ships with the Windows build of mise, so --windows-launcher=exe only works when generating on Windows.

What it means

Generating native Windows task stub launchers (--windows-launcher=exe) requires mise-shim.exe, which is looked up next to the running mise binary or on PATH (find_mise_shim_bin). If the launcher kind is native Exe and the shim cannot be found, mise bails instead of silently falling back to a .cmd stub — stubs are committed files, so writing a different file than asked for would corrupt someone's commit.

Source

Thrown at src/cli/generate/task_stubs.rs:279

    /// be ours, so none is written, replaced, or removed -- the same side the `.cmd` marker check
    /// errs on.
    shim_bin: Option<PathBuf>,
}

impl Launchers {
    fn resolve(kind: WindowsLauncher) -> Result<Self> {
        // Beside the mise doing the generating, not beside `--mise-bin`: that flag names the mise
        // a stub should *call*, which is often a path that does not exist yet, while
        // mise-shim.exe ships next to this binary.
        let shim_bin = env::current_exe()
            .ok()
            .as_deref()
            .and_then(find_mise_shim_bin);
        let native = matches!(kind, WindowsLauncher::Exe);
        if native && shim_bin.is_none() {
            // Not a fallback to `.cmd`. Stubs are committed, so quietly writing a different file
            // from the one asked for puts it in someone's commit.
            bail!(
                "cannot write native task stub launchers: mise-shim.exe was not found next to this mise or on PATH. \
                 It ships with the Windows build of mise, so --windows-launcher=exe only works when generating on Windows."
            );
        }
        Ok(Self { native, shim_bin })
    }

    /// Where this run's launcher for `stub` goes, or `None` when the stub's own name already ends
    /// in an executable extension.
    fn path(&self, stub: &Path) -> Option<PathBuf> {
        if self.native {
            super::windows_exe_launcher_path(stub)
        } else {
            super::windows_launcher_path(stub)
        }
    }

    /// Where the launcher of the form this run is *not* writing would be.

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Generate the stubs on a Windows machine where mise-shim.exe ships with mise
  2. Use the default --windows-launcher (cmd) instead of exe when generating off-Windows
  3. If on Windows, ensure mise-shim.exe sits next to the mise binary or is on PATH (reinstall mise if missing)

Example fix

// before (on Linux)
mise generate task-stubs --windows-launcher=exe
// error: mise-shim.exe was not found...

// after
mise generate task-stubs   # default launcher; or run on Windows for exe
Defensive patterns

Strategy: validation

Validate before calling

# shell: verify shim availability before requesting exe launchers
if command -v mise-shim.exe >/dev/null 2>&1 || [ -x "$(dirname "$(command -v mise)")/mise-shim.exe" ]; then
  mise generate task-stubs --windows-launcher=exe
else
  mise generate task-stubs   # default launcher
fi

Prevention

When it happens

Trigger: Running `mise generate task-stubs --windows-launcher=exe` (resolve) on a non-Windows machine, or any environment where mise-shim.exe is neither adjacent to the mise executable nor on PATH.

Common situations: Cross-generating Windows stubs from Linux/macOS CI; running a mise build that lacks the bundled shim; a stripped-down mise install without the Windows payload.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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