Hmbown/CodeWhale · error

dsh plugin remove failed

Error message

dsh plugin remove {BUNDLE_PACKAGE_NAME} failed: {}

What it means

remove_from_profile runs `dsh plugin remove <BUNDLE_PACKAGE_NAME>` to unregister the Codewhale bundle from the profile and bails if dsh exits non-success, echoing dsh's output excerpt. This keeps the caller from believing the bundle was unlinked when dsh actually refused or failed.

Solutions

  1. Read the excerpt: if the plugin is already gone, treat removal as done and clean up remaining files
  2. Run `dsh plugin list` to see what is actually registered in BUNDLE_PROFILE
  3. Fix any dsh-reported permission/lock issue and retry
  4. Repair or reinstall dsh if the CLI itself is failing

Example fix

// before
// remove fails: dsh plugin remove codewhale-bundle failed: not found
// after
if dsh plugin list | grep -q codewhale-bundle; then codewhale dsh remove-bundle; fi
Defensive patterns

Strategy: try-catch

Validate before calling

let out = std::process::Command::new("dsh").args(["plugin", "list"]).output()?;
let registered = String::from_utf8_lossy(&out.stdout).contains("codewhale-bundle");
if !registered { eprintln!("bundle already absent; nothing to remove"); }

Type guard

fn bundle_installed(dsh_list_output: &str, bundle_name: &str) -> bool {
    dsh_list_output.contains(bundle_name)
}

Try / catch

match remove_from_profile(...) {
    Err(e) if e.to_string().contains("plugin remove") => {
        // treat already-absent as success after verifying via plugin list
        verify_bundle_absent()?;
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling remove_from_profile (via remove-bundle) when the bundle plugin is not present in the profile, dsh errors, or the profile is locked/inaccessible.

Common situations: Running remove-bundle when the bundle was already removed manually with `dsh plugin remove`; a corrupted dsh profile; permission problems in the dsh home directory.

Related errors


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

Appendix: source

Thrown at crates/tui/src/integrations/dsh/bundle.rs:488

    Ok((app_source, outcomes))
}

pub(crate) fn remove_from_profile(
    runner: &dyn DshRunner,
    detection: &DshDetection,
) -> Result<PluginCommandOutcome> {
    let binary = detection
        .binary
        .as_ref()
        .ok_or_else(|| anyhow::anyhow!("dsh binary is unknown"))?;
    let outcome = run_dsh_plugin(
        runner,
        binary,
        BUNDLE_PROFILE,
        &["remove", BUNDLE_PACKAGE_NAME],
    )?;
    if !outcome.success {
        anyhow::bail!(
            "dsh plugin remove {BUNDLE_PACKAGE_NAME} failed: {}",
            outcome.output_excerpt
        );
    }
    Ok(outcome)
}

/// Read the dedicated profile's `dsh.profile.bundles` (DSH-owned manifest,
/// read-only) so status can prove the bundle is actually composed.
pub(crate) fn profile_bundles(profile_dir: &Path) -> Option<Vec<String>> {
    let text = std::fs::read_to_string(profile_dir.join("package.json")).ok()?;
    let json: serde_json::Value = serde_json::from_str(&text).ok()?;
    Some(
        json.get("dsh")?
            .get("profile")?
            .get("bundles")?
            .as_array()?
            .iter()

View on GitHub (pinned to 73e0f67d83)