jdx/mise · error

does not support declarative package removal

Error message

{} does not support declarative package removal

What it means

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.

Solutions

  1. Remove the `state = "absent"` declaration, or change the package's manager so it resolves to a backend that supports removal (check `supports_remove()`).
  2. Uninstall the package manually with the manager's own CLI (e.g. `nix profile remove <name>`) and drop the absent entry from config.
  3. Implement `remove()` in the custom backend if you own it, or switch the backend to one with native uninstall support.
  4. Pin the package to a specific manager in config so it always resolves to a removal-capable backend.

Example fix

# before
[packages]
"nix:ripgrep" = { state = "absent" }

# after
# remove the entry, or target a removal-capable manager:
[packages]
"apt:ripgrep" = { state = "absent" }
Defensive patterns

Strategy: validation

Validate before calling

// Rust caller check before declaring removals
if !manager.supports_remove() && request.state == PackageState::Absent {
    eprintln!("{} cannot remove packages; remove it manually or pick another manager", manager.name());
}

Type guard

fn supports_removal(m: &dyn SystemPackageManager) -> bool { m.supports_remove() }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/0999c99de172400c. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/mod.rs:206

    /// This is *availability*, not installed state — [`Self::installed`]
    /// cannot answer it (apt's asks dpkg, which only knows what is already on
    /// the box). Used to resolve a plugin's candidate package names, where the
    /// same capability is packaged under different names across distro
    /// releases. Must be side-effect free and never elevate.
    ///
    /// The default reports every name as available, which makes candidate
    /// resolution pick the first one — the behavior before candidate lists
    /// existed. Managers override it where the query is cheap.
    async fn available(&self, names: &[String]) -> Result<Vec<bool>> {
        Ok(vec![true; names.len()])
    }

    /// Install the given packages (already filtered to missing, mismatched, or repairable).
    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()>;

    /// Remove packages declared with `state = "absent"`.
    async fn remove(&self, _pkgs: &[PackageRequest], _opts: &InstallOpts) -> Result<()> {
        eyre::bail!(
            "{} does not support declarative package removal",
            self.name()
        )
    }

    fn supports_remove(&self) -> bool {
        false
    }

    /// Install with manager-specific declarative options. Managers without
    /// additional package options use the ordinary install path unchanged.
    async fn install_with_options(
        &self,
        pkgs: &[PackageRequest],
        opts: &InstallOpts,
        _manager_options: &ManagerPackageOptions,
    ) -> Result<()> {
        self.install(pkgs, opts).await

View on GitHub (pinned to 533346cc37)