jdx/mise · error

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

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

`mise generate task-stubs --windows-launcher=exe` writes native .exe stub launchers that must copy an existing mise-shim.exe shipped with the Windows build of mise. This error means that binary could not be found next to the running mise or on PATH, typically because generation is running on a non-Windows platform where mise-shim.exe is not distributed.

Solutions

  1. Run the generation on Windows, where mise-shim.exe ships with mise
  2. Omit `--windows-launcher=exe` so stubs fall back to .cmd launchers
  3. If on Windows, reinstall mise so mise-shim.exe sits next to the binary, or put it on PATH

Example fix

// before
mise generate task-stubs --windows-launcher=exe   # on Linux CI
// after
mise generate task-stubs                          # .cmd fallback, or run on Windows
Defensive patterns

Strategy: validation

Validate before calling

const isWindows = process.platform === 'win32';
if (wantExeLaunchers && !isWindows) {
  throw new Error('--windows-launcher=exe requires generating on Windows (mise-shim.exe ships only there)');
}

Type guard

const canGenerateExeStubs = (): boolean =>
  process.platform === 'win32';

Try / catch

try {
  execSync('mise generate task-stubs --windows-launcher=exe');
} catch {
  console.warn('exe launchers unavailable on this platform; falling back to .cmd');
  execSync('mise generate task-stubs');
}

Prevention

When it happens

Trigger: Running `mise generate task-stubs --windows-launcher=exe` on Linux/macOS, or on Windows with a mise install missing mise-shim.exe and no copy on PATH.

Common situations: CI jobs generating committed task stubs on a Linux runner while requesting exe launchers; users on a POSIX dev machine trying to pre-generate Windows launchers for a repo.

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@533346cc37 (2026-09-17). Data as JSON: /api/errors/c161db4f195c648f. Report an issue: GitHub.

Appendix: 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 533346cc37)