Hmbown/CodeWhale · error

refusing to uninstall the

Error message

refusing to uninstall the {} bundle `{selector}`; remove it from its own root

What it means

`uninstall_plugin` refuses to remove any bundle whose scope is not `PluginScope::User`; such bundles are owned by their own root (app install, project, etc.) and must be removed there. The message names the scope and points at the owning root.

Solutions

  1. Remove the bundle at its owning root (uninstall/upgrade the app, or delete it from the project config/repo)
  2. If it is user-installed but the scope is wrong, reinstall it with `/plugin install` so it is registered at user scope
  3. Confirm the scope via `/plugin list` before attempting removal

Example fix

// before
/plugin uninstall builtin-lint   # not user scope
// after: remove at its own root
# built-ins go away with an app upgrade/reinstall
// project bundle: remove from the repo's plugin manifest
Defensive patterns

Strategy: validation

Validate before calling

let plugin = registry.get(selector)?;
if plugin.scope != PluginScope::User {
    eprintln!("{} is {:?}-scoped; remove it at its own root", selector, plugin.scope);
    return;
}

Try / catch

match uninstall_plugin(selector, registry) {
    Err(e) if e.to_string().contains("refusing to uninstall") => {
        eprintln!("owned by another scope; remove it there (app or project)");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `/plugin uninstall <selector>` (through `execute` → `uninstall_plugin`) where `registry.get(selector).scope != PluginScope::User` — e.g. uninstalling a built-in or project-scoped bundle.

Common situations: Trying to remove a plugin that shipped with the application; trying to delete a repo-managed plugin via the plugin command instead of editing the repo.

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 Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/79c206e7a0db7b13. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/plugins/mutation.rs:208

            content_hash: Some(installed.content_hash),
            installed_content_hash: Some(installed.installed_content_hash),
            outcome: PluginMutationOutcome::Updated,
        },
        PluginUpdateResult::NeedsApproval(host) => blocked(host, true),
        PluginUpdateResult::NetworkDenied(host) => blocked(host, false),
    })
}

fn uninstall_plugin(
    selector: &str,
    registry: &mut PluginRegistry,
) -> Result<PluginMutationReceipt> {
    let plugin = registry
        .get(selector)
        .with_context(|| format!("Plugin bundle `{selector}` was not found"))?
        .clone();
    if plugin.scope != PluginScope::User {
        bail!(
            "refusing to uninstall the {} bundle `{selector}`; remove it from its own root",
            plugin.scope.as_str()
        );
    }
    if plugin.enabled {
        bail!("plugin `{selector}` is enabled; disable it first with /plugin disable {selector}");
    }
    let plugins_dir = user_plugins_dir(registry)?;
    install::uninstall(plugin.name(), &plugins_dir)?;
    registry
        .prune_state_entry(selector)
        .map_err(anyhow::Error::msg)?;
    Ok(PluginMutationReceipt {
        name: plugin.name().to_string(),
        path: None,
        content_hash: None,
        installed_content_hash: None,
        outcome: PluginMutationOutcome::Uninstalled,

View on GitHub (pinned to 73e0f67d83)