{"record":{"id":"c161db4f195c648f","repo":"jdx/mise","slug":"cannot-write-native-task-stub-launchers-mise-shim","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/task_stubs.rs","lineNumber":279,"sourceCode":"    /// be ours, so none is written, replaced, or removed -- the same side the `.cmd` marker check\n    /// errs on.\n    shim_bin: Option<PathBuf>,\n}\n\nimpl Launchers {\n    fn resolve(kind: WindowsLauncher) -> Result<Self> {\n        // Beside the mise doing the generating, not beside `--mise-bin`: that flag names the mise\n        // a stub should *call*, which is often a path that does not exist yet, while\n        // mise-shim.exe ships next to this binary.\n        let shim_bin = env::current_exe()\n            .ok()\n            .as_deref()\n            .and_then(find_mise_shim_bin);\n        let native = matches!(kind, WindowsLauncher::Exe);\n        if native && shim_bin.is_none() {\n            // Not a fallback to `.cmd`. Stubs are committed, so quietly writing a different file\n            // from the one asked for puts it in someone's commit.\n            bail!(\n                \"cannot write native task stub launchers: mise-shim.exe was not found next to this mise or on PATH. \\\n                 It ships with the Windows build of mise, so --windows-launcher=exe only works when generating on Windows.\"\n            );\n        }\n        Ok(Self { native, shim_bin })\n    }\n\n    /// Where this run's launcher for `stub` goes, or `None` when the stub's own name already ends\n    /// in an executable extension.\n    fn path(&self, stub: &Path) -> Option<PathBuf> {\n        if self.native {\n            super::windows_exe_launcher_path(stub)\n        } else {\n            super::windows_launcher_path(stub)\n        }\n    }\n\n    /// Where the launcher of the form this run is *not* writing would be.","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/generate/task_stubs.rs#L261-L297","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the generation on Windows, where mise-shim.exe ships with mise","Omit `--windows-launcher=exe` so stubs fall back to .cmd launchers","If on Windows, reinstall mise so mise-shim.exe sits next to the binary, or put it on PATH"],"exampleFix":"// before\nmise generate task-stubs --windows-launcher=exe   # on Linux CI\n// after\nmise generate task-stubs                          # .cmd fallback, or run on Windows","handlingStrategy":"validation","validationCode":"const isWindows = process.platform === 'win32';\nif (wantExeLaunchers && !isWindows) {\n  throw new Error('--windows-launcher=exe requires generating on Windows (mise-shim.exe ships only there)');\n}","typeGuard":"const canGenerateExeStubs = (): boolean =>\n  process.platform === 'win32';","tryCatchPattern":"try {\n  execSync('mise generate task-stubs --windows-launcher=exe');\n} catch {\n  console.warn('exe launchers unavailable on this platform; falling back to .cmd');\n  execSync('mise generate task-stubs');\n}","preventionTips":["Only request --windows-launcher=exe from Windows machines or Windows CI runners","Verify mise-shim.exe sits next to the mise binary before generating","Default to the .cmd launcher fallback for cross-platform repos","Split Windows-only generation into a windows-labeled CI job"],"tags":["cli","windows","task-stubs","missing-binary"],"backgroundTag":"unsupported-platform","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"}