Hmbown/CodeWhale · error

plugin ` ` is enabled; disable it first with /plugin disable

Error message

plugin `{selector}` is enabled; disable it first with /plugin disable {selector}

What it means

Before uninstalling, `uninstall_plugin` requires the bundle to be disabled. If `plugin.enabled` is true it bails and tells the user the exact `/plugin disable <selector>` command to run first. This prevents deleting a bundle that is actively loaded.

Solutions

  1. Run `/plugin disable <selector>` first, then `/plugin uninstall <selector>`
  2. In scripts, call the disable mutation before the uninstall mutation and check its receipt

Example fix

// before
/plugin uninstall myplugin      # enabled -> refuse
// after
/plugin disable myplugin
/plugin uninstall myplugin
Defensive patterns

Strategy: validation

Validate before calling

let plugin = registry.get(selector)?;
if plugin.enabled {
    eprintln!("disable {} before uninstalling: /plugin disable {}", selector, selector);
    return;
}

Try / catch

match uninstall_plugin(selector, registry) {
    Err(e) if e.to_string().contains("disable it first") => {
        execute_disable(selector)?;   // /plugin disable <selector>
        uninstall_plugin(selector, registry)?;
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `/plugin uninstall <selector>` on a user-scope bundle while it is still enabled in the registry.

Common situations: Uninstalling during cleanup without realizing the plugin is active; scripted uninstall loops that do not disable first.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/d1ee8daf019ad9f8. Report an issue: GitHub.

Appendix: source

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

    })
}

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,
    })
}

fn blocked(host: String, needs_approval: bool) -> PluginMutationReceipt {
    PluginMutationReceipt {
        name: String::new(),

View on GitHub (pinned to 73e0f67d83)