{"record":{"id":"a9d32d0dc8cf8223","repo":"jdx/mise","slug":"failed-to-uninstall-tv","errorCode":null,"errorMessage":"failed to uninstall {tv}","messagePattern":"failed to uninstall (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/uninstall.rs","lineNumber":125,"sourceCode":"        };\n        for (plugin, tv) in to_remove {\n            let key = format!(\"{}@{}\", tv.ba().short, tv.version);\n            let tool = progress\n                .as_ref()\n                .and_then(|progress| progress.start_tool(&key));\n            let pr = match &tool {\n                Some(tool) => tool.reporter(),\n                None => mpr.add(&tv.style()),\n            };\n            let result = plugin\n                .uninstall_version(&config, &tv, pr.as_ref(), self.is_dry_run())\n                .await;\n            if let Some(tool) = &tool {\n                tool.complete(result.as_ref().err().map(|e| e.to_string()).as_deref());\n            }\n            if let Err(err) = result {\n                error!(\"{err}\");\n                return Err(eyre!(err).wrap_err(format!(\"failed to uninstall {tv}\")));\n            }\n            if self.is_dry_run() {\n                pr.finish_with_message(\"uninstalled (dry-run)\".into());\n            } else {\n                if let Err(err) = crate::tool_purgatory::forget_path(&tv.install_path()) {\n                    warn!(\"failed to clear tool purgatory entry: {err:#}\");\n                }\n                if tool.is_none() {\n                    pr.finish_with_message(\"uninstalled\".into());\n                }\n            }\n        }\n        if let Some(progress) = progress.as_mut() {\n            progress.finish(vec![]);\n        }\n\n        if self.is_dry_run() {\n            if self.dry_run_code && has_work {","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/uninstall.rs#L107-L143","documentation":"`mise uninstall` wraps any failure from a tool backend's uninstall routine with the context \"failed to uninstall {tv}\" (the tool@version being removed). The backend error is preserved as the wrapped cause, so this is a contextual wrapper, not a root cause. It is returned (not just warned), so the CLI exits non-zero.","triggerScenarios":"Running `mise uninstall <tool>@<version>` when the backend's uninstall call returns Err — e.g. the install directory is missing but tracked, files are held open / permission-denied on Windows, or the underlying remove fails mid-way. The `tool.complete(...)` hook is invoked with the error string before wrapping.","commonSituations":"Manually deleted install dirs leaving purgatory/metadata stale; another process (editor, AV, running tool binary) locking files; partial installs; removing a version while a shim or task still uses it.","solutions":["Read the wrapped cause (full `{err:#}` chain via verbose output) to find the backend failure, then fix that specific condition.","Close processes using the install path (or stop AV scanning) and retry the uninstall.","If the directory is already gone, remove stale metadata (the version dir under mise's installs path) or reinstall then uninstall.","Use `mise uninstall --dry-run` first to see what will be removed."],"exampleFix":"// before\nmise uninstall node@20.0.0   # fails: install dir locked\n// after\npkill -f node; mise uninstall node@20.0.0","handlingStrategy":"try-catch","validationCode":"mise ls <tool>  # confirm the version exists before uninstalling\nmise uninstall <tool>@<version> --dry-run","typeGuard":null,"tryCatchPattern":"match mise_uninstall(tool, version) {\n    Err(e) => {\n        eprintln!(\"uninstall failed: {e:#}\"); // inspect full chain for root cause\n        // e.g. kill locking processes, then retry once\n    }\n    Ok(()) => {}\n}","preventionTips":["Check the tool/version exists before uninstalling.","Use --dry-run first to preview removals.","Close running tool processes before removing versions.","Avoid manually deleting install directories; always go through mise."],"tags":["rust","cli","uninstall","toolset"],"backgroundTag":"resource-not-found","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"}