{"record":{"id":"bc2cb7ac5e54ff97","repo":"jdx/mise","slug":"mise-is-installed-via-a-package-manager-cannot-up","errorCode":null,"errorMessage":"mise is installed via a package manager, cannot update","messagePattern":"mise is installed via a package manager, cannot update","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/self_update.rs","lineNumber":423,"sourceCode":"/// when the child exits non-zero; a child that never starts comes back as the bare OS error, so an\n/// `ACCESS_DENIED` from spawning the freshly written binary arrives as nothing but\n/// \"Access is denied. (os error 5)\".\n///\n/// Takes the binary to run rather than reading [`env::MISE_BIN`] itself, so a test can drive the\n/// failure without a real update.\nfn update_plugins(bin: &std::path::Path) {\n    if let Err(err) = cmd!(bin, \"plugins\", \"update\").run() {\n        warn!(\"Failed to update plugins: {err}\");\n    }\n}\n\nimpl SelfUpdate {\n    pub(crate) async fn run(self) -> Result<()> {\n        if !Self::is_available() && !self.force {\n            if let Some(instructions) = upgrade_instructions_text() {\n                warn!(\"{}\", instructions);\n            }\n            bail!(\"mise is installed via a package manager, cannot update\");\n        }\n        // Before the update, not after: this run is about to create a copy of its own, and that one\n        // is in use rather than stale. Before the length check too, and that ordering is the whole\n        // point: a `TEMP` long enough to refuse the update is the case the leftovers come from, so\n        // running the sweep afterwards means the only machines that accumulate them are the only\n        // machines that never reach the code that collects them.\n        #[cfg(windows)]\n        sweep_helper_orphans();\n        #[cfg(windows)]\n        Self::ensure_temp_dir_can_replace_binary()?;\n        let status = self.do_update()?;\n\n        if status.is_updated() {\n            let version = status.version().to_string();\n            let styled_version = style(&version).bright().yellow();\n            miseprintln!(\"Updated mise to {styled_version}\");\n            // On Windows, \"exe\"/\"hardlink\" shims are copies of mise-shim.exe and\n            // go stale after an update. Refresh mise-shim.exe, and ONLY if that","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/self_update.rs#L405-L441","documentation":"`mise self-update` replaces the mise binary in place, which only works when mise owns its install location. When mise detects it was installed by a package manager (brew, apt, cargo, npm, etc.), it refuses to self-update to avoid corrupting the package-managed install. Unless --force is passed, it prints upgrade instructions and bails.","triggerScenarios":"Running `mise self-update` (directly or via maybe_auto_update) when `Self::is_available()` returns false because the executable path resolves to a package-manager-managed location.","commonSituations":"mise installed via Homebrew, APT, pacman, npm, or cargo; CI images with distro-packaged mise; users upgrading a brew install with mise instead of `brew upgrade mise`.","solutions":["Update through the original package manager (brew upgrade mise, apt upgrade, cargo install mise, etc.)","Reinstall via the official install script or curl method to get a self-updatable binary","Use `mise self-update --force` only if you understand the binary is not package-managed"],"exampleFix":"// before\nmise self-update   # error: installed via package manager\n// after\nbrew upgrade mise   # or the package manager that installed mise","handlingStrategy":"fallback","validationCode":"mise self-update --dry-run 2>/dev/null || upgrade_via_package_manager","typeGuard":null,"tryCatchPattern":"if ! mise self-update 2>&1 | grep -q 'package manager'; then brew upgrade mise; fi","preventionTips":["Track how mise was installed and use that channel for upgrades","Prefer brew/cargo/apt upgrade over self-update for package-managed installs"],"tags":["cli","self-update","package-manager"],"backgroundTag":"unsupported-operation","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"}