{"record":{"id":"0999c99de172400c","repo":"jdx/mise","slug":"does-not-support-declarative-package-removal","errorCode":null,"errorMessage":"{} does not support declarative package removal","messagePattern":"(.+?) does not support declarative package removal","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/mod.rs","lineNumber":206,"sourceCode":"    /// This is *availability*, not installed state — [`Self::installed`]\n    /// cannot answer it (apt's asks dpkg, which only knows what is already on\n    /// the box). Used to resolve a plugin's candidate package names, where the\n    /// same capability is packaged under different names across distro\n    /// releases. Must be side-effect free and never elevate.\n    ///\n    /// The default reports every name as available, which makes candidate\n    /// resolution pick the first one — the behavior before candidate lists\n    /// existed. Managers override it where the query is cheap.\n    async fn available(&self, names: &[String]) -> Result<Vec<bool>> {\n        Ok(vec![true; names.len()])\n    }\n\n    /// Install the given packages (already filtered to missing, mismatched, or repairable).\n    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()>;\n\n    /// Remove packages declared with `state = \"absent\"`.\n    async fn remove(&self, _pkgs: &[PackageRequest], _opts: &InstallOpts) -> Result<()> {\n        eyre::bail!(\n            \"{} does not support declarative package removal\",\n            self.name()\n        )\n    }\n\n    fn supports_remove(&self) -> bool {\n        false\n    }\n\n    /// Install with manager-specific declarative options. Managers without\n    /// additional package options use the ordinary install path unchanged.\n    async fn install_with_options(\n        &self,\n        pkgs: &[PackageRequest],\n        opts: &InstallOpts,\n        _manager_options: &ManagerPackageOptions,\n    ) -> Result<()> {\n        self.install(pkgs, opts).await","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/mod.rs#L188-L224","documentation":"This error comes from the default implementation of `SystemPackageManager::remove`, which exists so managers without uninstall support fail explicitly instead of silently doing nothing. When a config declares packages with `state = \"absent\"`, mise calls `remove` on the resolved backend; backends that don't implement declarative removal (they only override `install`/`upgrade`) inherit this default, which reports the manager by name and aborts. Call `supports_remove()` to check capability before declaring absent packages.","triggerScenarios":"A package declaration sets `state = \"absent\"` while the package resolves to a system package manager whose backend does not override `remove()` (e.g. the Nix manager, which only implements install/upgrade). `remove` is invoked during the reconcile/apply step.","commonSituations":"Users migrating a mise.toml between machines where the backend differs (package handled by pacman at home, nix elsewhere) and keeping `state = \"absent\"`; teams declaring cleanup entries for tools that are managed by a manager that never supported uninstall.","solutions":["Remove the `state = \"absent\"` declaration, or change the package's manager so it resolves to a backend that supports removal (check `supports_remove()`).","Uninstall the package manually with the manager's own CLI (e.g. `nix profile remove <name>`) and drop the absent entry from config.","Implement `remove()` in the custom backend if you own it, or switch the backend to one with native uninstall support.","Pin the package to a specific manager in config so it always resolves to a removal-capable backend."],"exampleFix":"# before\n[packages]\n\"nix:ripgrep\" = { state = \"absent\" }\n\n# after\n# remove the entry, or target a removal-capable manager:\n[packages]\n\"apt:ripgrep\" = { state = \"absent\" }","handlingStrategy":"validation","validationCode":"// Rust caller check before declaring removals\nif !manager.supports_remove() && request.state == PackageState::Absent {\n    eprintln!(\"{} cannot remove packages; remove it manually or pick another manager\", manager.name());\n}","typeGuard":"fn supports_removal(m: &dyn SystemPackageManager) -> bool { m.supports_remove() }","tryCatchPattern":null,"preventionTips":["Check supports_remove() before writing state = \"absent\" entries","Keep per-manager package files separate so absent entries only target removal-capable managers","Uninstall via the manager's own CLI when unsupported"],"tags":["package-manager","unsupported-operation","nix","declarative-removal"],"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"}