Hmbown/CodeWhale · error
the Codewhale bundle is still installed in DSH profile
Error message
the Codewhale bundle is still installed in DSH profile `{}`; run `{CLI_COMMAND} remove-bundle` first What it means
remove deletes only Codewhale-owned files (overlay, skin, skin preview) while keeping receipt history. If the receipt's current record still shows the Codewhale bundle installed in the dsh profile, remove refuses and instructs the user to run remove-bundle first, since deleting the files while the plugin remains linked would leave dsh in a broken state.
Solutions
- Run `codewhale dsh remove-bundle` first, then `remove`
- If remove-bundle keeps failing, fix the underlying dsh plugin remove error (see its excerpt)
- Manually verify with `dsh plugin list` that the bundle is gone, then clean the receipt state per docs
Example fix
// before codewhale dsh remove # fails: bundle still installed // after codewhale dsh remove-bundle codewhale dsh remove
Defensive patterns
Strategy: validation
Validate before calling
let doc = DshReceiptDocument::load(&paths.receipt)?;
if doc.current.as_ref().is_some_and(|r| r.bundle.is_some()) {
eprintln!("run `codewhale dsh remove-bundle` before remove");
} Type guard
fn bundle_still_installed(record: &DshConnectionRecord) -> bool {
record.bundle.is_some()
} Try / catch
match dsh_remove() {
Err(e) if e.to_string().contains("still installed") => {
dsh_remove_bundle()?;
dsh_remove()?;
}
r => r,
} Prevention
- Follow the documented lifecycle order: remove-bundle, then remove
- Check the receipt's bundle field before any uninstall
- Retry failed remove-bundle operations before proceeding
When it happens
Trigger: Calling `remove` (disconnect) while the current receipt record has bundle.is_some() — i.e. install-bundle succeeded and the bundle is still registered in BUNDLE_PROFILE.
Common situations: User tries `codewhale dsh remove` without first running `remove-bundle`; a previous remove-bundle failed partway leaving the receipt showing the bundle installed.
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
- bundle already installed; use
- DSH integration is disabled; run
- DSH is not connected; nothing to
- DSH is not connected; run
- dsh plugin add failed
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/1230238a0c78eda1.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/integrations/dsh/mod.rs:577
identity_summary: Some(identity_summary(&record.identity)),
permission_mode: Some(record.identity.permission_mode.as_str().to_string()),
note: None,
});
doc.current = Some(record.clone());
doc.save(&paths.receipt)?;
crate::audit::log_sensitive_event(
&format!("integration.dsh.{}", event.as_str()),
serde_json::json!({ "overlay_path": paths.overlay.display().to_string() }),
);
Ok(record)
}
/// Delete only Codewhale-owned files; keep the receipt history with a
/// terminal `remove` entry. Never touches `$DSH_HOME`.
pub(crate) fn remove(paths: &DshPaths) -> Result<Vec<PathBuf>> {
let mut doc = DshReceiptDocument::load(&paths.receipt)?;
if doc.current.as_ref().is_some_and(|r| r.bundle.is_some()) {
anyhow::bail!(
"the Codewhale bundle is still installed in DSH profile `{}`; run `{CLI_COMMAND} remove-bundle` first",
bundle::BUNDLE_PROFILE
);
}
let mut removed = Vec::new();
for path in [&paths.overlay, &paths.skin, &paths.skin_preview] {
match std::fs::remove_file(path) {
Ok(()) => removed.push(path.clone()),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
Err(error) => return Err(error).with_context(|| format!("remove {}", path.display())),
}
}
let previous = doc.current.take();
let now = now_rfc3339();
doc.push(DshReceiptEntry {
event: DshReceiptEvent::Remove,
at: now,
codewhale_version: codewhale_version(),View on GitHub (pinned to 73e0f67d83)