Hmbown/CodeWhale · error

Refusing to MCP server ' ' from plugin bundle ` `: .

Error message

Refusing to {operation} MCP server '{server_name}' from plugin bundle `{}`: {reason}. {remediation}

What it means

validate_before_use calls verify_plugin_component_authority to confirm the plugin bundle still has the authority (signed/approved component identity matching the required capability) it had at review time. On failure it builds a user-facing refusal message naming the operation, server, plugin bundle, the authority reason, and remediation. It is a security gate: a plugin whose bundle no longer matches its reviewed authority is blocked from being used or spawned.

Solutions

  1. Reinstall or re-review the plugin so authority is recomputed over the current bundle (follow the {remediation} text in the message).
  2. Revert local modifications to the plugin bundle so its content/capability hashes match the reviewed record.
  3. Update the plugin's capability grant if a legitimately new capability is required.
  4. Check for concurrent writers to the plugin directory and lock/serialize plugin updates.

Example fix

// before
codewhale plugin edit ~/.plugins/mybundle/plugin.toml  # drifts from reviewed authority
// after
codewhale plugin review ~/.plugins/mybundle && codewhale plugin enable mybundle  # re-establish authority
Defensive patterns

Strategy: validation

Validate before calling

// confirm bundle integrity against recorded authority before use
let validated = PluginManifest::validate_from_path(&bundle.manifest_path)?;
assert_eq!(validated.content_hash, authority.content_hash, "bundle drifted");
assert_eq!(validated.capability_hash, authority.capability_hash, "capabilities changed");

Type guard

fn authority_intact(bundle: &PluginBundle, authority: &Authority) -> bool {
    PluginManifest::validate_from_path(&bundle.manifest_path)
        .map(|v| v.content_hash == authority.content_hash
                && v.capability_hash == authority.capability_hash)
        .unwrap_or(false)
}

Try / catch

match validate_before_use(&authority, op).await {
    Err(e) if e.to_string().starts_with("Refusing to") => {
        // follow the remediation in the message: re-review/reinstall the plugin
        registry.reinstall(&authority.plugin_name).await?;
        retry(op).await
    }
    other => other,
}

Prevention

When it happens

Trigger: validate_before_stdio_spawn → validate_before_use with a plugin whose bundle content or capability hashes no longer match the recorded authority — modified plugin files after review, a capability requirement not granted to the component, or a bundle swapped on disk.

Common situations: User hand-edited a plugin bundle after install, plugin upgraded out-of-band while the old authority record persisted, a manifest added a new capability that wasn't part of the reviewed grant, or bundle hash drift from a broken sync/restore.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/mcp.rs:772

    fn required_capability(&self) -> crate::plugins::activation::PluginActivationCapability {
        if self.approved_remote_endpoint.is_some() {
            crate::plugins::activation::PluginActivationCapability::McpRemote
        } else {
            crate::plugins::activation::PluginActivationCapability::McpStdio
        }
    }

    fn validate_before_use(&self, server_name: &str, operation: &str) -> Result<()> {
        let remediation = format!(
            "Run `/plugin reload`, inspect `/plugin show {0}`, then repeat the displayed trust command and `/plugin enable {0}` before retrying",
            self.authority.plugin_name
        );
        crate::plugins::registry::verify_plugin_component_authority(
            &self.authority,
            self.required_capability(),
        )
        .map_err(|reason| {
            anyhow::anyhow!(
                "Refusing to {operation} MCP server '{server_name}' from plugin bundle `{}`: {reason}. {remediation}",
                self.authority.plugin_name
            )
        })
    }

    fn validate_remote_endpoint(&self, server_name: &str, endpoint: &str) -> Result<()> {
        let (endpoint, origin) = reviewed_remote_endpoint_identity(endpoint)?;
        if self.approved_remote_endpoint.as_deref() != Some(endpoint.as_str())
            || self.approved_remote_origin.as_deref() != Some(origin.as_str())
        {
            anyhow::bail!(
                "Refusing MCP server '{server_name}': its remote endpoint no longer matches the reviewed plugin origin"
            );
        }
        Ok(())
    }

View on GitHub (pinned to 73e0f67d83)