{"record":{"id":"f4b4d1b09b7b4c06","repo":"jdx/mise","slug":"multiple-tools-specified-use-all-to-uninstall-a","errorCode":null,"errorMessage":"multiple tools specified, use --all to uninstall all versions","messagePattern":"multiple tools specified, use --all to uninstall all versions","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/uninstall.rs","lineNumber":72,"sourceCode":"\nimpl Uninstall {\n    pub(super) fn is_dry_run(&self) -> bool {\n        self.dry_run || self.dry_run_code\n    }\n\n    pub(crate) async fn run(self) -> Result<()> {\n        let config = Config::get().await?;\n        let tool_versions = if self.installed_tool.is_empty() && self.all {\n            self.get_all_tool_versions(&config).await?\n        } else {\n            self.get_requested_tool_versions(&config).await?\n        };\n        let tool_versions = tool_versions\n            .into_iter()\n            .unique_by(|(_, tv)| (tv.request.ba().short.clone(), tv.version.clone()))\n            .collect::<Vec<_>>();\n        if !self.all && tool_versions.len() > self.installed_tool.len() {\n            bail!(\"multiple tools specified, use --all to uninstall all versions\");\n        }\n        let removed_install_paths = tool_versions\n            .iter()\n            .map(|(_, tv)| tv.install_path())\n            .collect::<Vec<_>>();\n\n        let mpr = MultiProgressReport::get();\n        let mut to_remove = Vec::with_capacity(tool_versions.len());\n        for (plugin, tv) in tool_versions {\n            // `is_version_installed` resolves the install path, so it says no for a link whose\n            // target is gone -- and that entry is precisely what someone running `uninstall` is\n            // trying to get rid of. Refusing it left the name occupied with no command able to\n            // free it. It is still not *installed*: this only decides whether there is something\n            // here to remove.\n            if !plugin.is_version_installed(&config, &tv, true)\n                && !file::entry_exists(tv.install_path())\n            {\n                warn!(\"{} is not installed\", tv.style());","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/uninstall.rs#L54-L90","documentation":"`mise uninstall <tool>` without --all only removes one version per named tool. If the number of resolved tool-version entries exceeds the number of tools named on the command line, multiple versions are targeted and mise requires explicit --all to confirm.","triggerScenarios":"Running `mise uninstall node` when several node versions are installed, without passing --all; naming a tool that resolves to multiple installed versions in scripts.","commonSituations":"Upgraded a tool several times leaving multiple versions, then uninstalling by name alone; batch-cleanup scripts that assumed uninstall removes everything.","solutions":["Add --all to remove every installed version: mise uninstall node --all","Target a single version explicitly: mise uninstall node@22.1.0","Run `mise ls` first to see how many versions are installed before choosing"],"exampleFix":"// before\nmise uninstall node\n// after\nmise uninstall node --all   # or: mise uninstall node@22.1.0","handlingStrategy":"validation","validationCode":"const info = JSON.parse(exec('mise ls --json')).find(t=>t.tool===name);\nconst n = info?.installed?.length ?? 0;\nexec(n > 1 ? `mise uninstall ${name} --all` : `mise uninstall ${name}`);","typeGuard":"const needsAllFlag = (installedCount: number, namedTools: number) => installedCount > namedTools;","tryCatchPattern":"try { exec(`mise uninstall ${name}`); } catch (e) { if (String(e).includes('--all')) exec(`mise uninstall ${name} --all`); else throw e; }","preventionTips":["Run `mise ls` to count installed versions before uninstalling","Use explicit version targets (tool@x.y.z) for surgical removals","Add --all in cleanup scripts that intend full removal"],"tags":["cli","uninstall","missing-flag"],"backgroundTag":"missing-required-flag","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"}