{"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/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/generate/task_stubs.rs#L261-L297","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Generate the stubs on a Windows machine where mise-shim.exe ships with mise","Use the default --windows-launcher (cmd) instead of exe when generating off-Windows","If on Windows, ensure mise-shim.exe sits next to the mise binary or is on PATH (reinstall mise if missing)"],"exampleFix":"// before (on Linux)\nmise generate task-stubs --windows-launcher=exe\n// error: mise-shim.exe was not found...\n\n// after\nmise generate task-stubs   # default launcher; or run on Windows for exe","handlingStrategy":"validation","validationCode":"# shell: verify shim availability before requesting exe launchers\nif command -v mise-shim.exe >/dev/null 2>&1 || [ -x \"$(dirname \"$(command -v mise)\")/mise-shim.exe\" ]; then\n  mise generate task-stubs --windows-launcher=exe\nelse\n  mise generate task-stubs   # default launcher\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only generate --windows-launcher=exe stubs on Windows hosts","Keep mise installed from the official Windows build so mise-shim.exe is bundled","Run the exe-launcher generation step in a Windows CI job, not the Linux build job"],"tags":["cli","windows","task-stubs","missing-binary"],"backgroundTag":"unsupported-platform","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}