Hmbown/CodeWhale · error
dsh plugin add failed
Error message
dsh plugin add {BUNDLE_PACKAGE_NAME} failed: {second_excerpt} What it means
After the app plugin is added, install_into_profile runs a second `dsh plugin add <bundle_dir>` to register the Codewhale bundle itself (BUNDLE_PACKAGE_NAME) with the profile. If that second invocation fails, this bail reports it with dsh's output excerpt. The two-step add means the bundle registration can fail independently of the app registration.
Solutions
- Check the excerpt for dsh's reason (duplicate, invalid dir, etc.) and fix that
- Remove the half-installed state: `dsh plugin remove <bundle>` in BUNDLE_PROFILE, then retry
- Re-run the full remove-bundle/install-bundle lifecycle via the CLI to get a clean state
- Verify the bundle directory exists and is intact before installing
Example fix
// before // second add fails on leftover plugin entry codewhale dsh install-bundle // after codewhale dsh remove-bundle codewhale dsh install-bundle # clean lifecycle retry
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure no stale bundle entry before installing
let out = std::process::Command::new("dsh").args(["plugin", "list"]).output()?;
if String::from_utf8_lossy(&out.stdout).contains("codewhale-bundle") {
eprintln!("stale bundle present; run remove-bundle first");
} Type guard
fn bundle_clean(dsh_list_output: &str, bundle_name: &str) -> bool {
!dsh_list_output.contains(bundle_name)
} Try / catch
match install_into_profile(...) {
Err(e) if e.to_string().contains("codewhale-bundle") => {
remove_from_profile_then_retry()?;
}
r => r?,
} Prevention
- Always run the full remove-bundle/install-bundle lifecycle instead of partial installs
- Check plugin list for stale entries after a failed install
- Avoid mutating the bundle directory between install steps
When it happens
Trigger: The second `dsh plugin add` targeting the bundle directory exits non-success — e.g. the bundle dir is invalid, dsh rejects a duplicate/conflicting plugin entry, or dsh errors mid-operation.
Common situations: A stale partially-installed bundle left in the profile from a failed earlier run; profile already contains a conflicting plugin id; bundle directory was mutated or removed between calls.
Related errors
- dsh plugin add failed
- dsh plugin remove failed
- bundle already installed; use
- DSH is not connected; run
- DSH plugin path not available
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/8b529f37c5a863f9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/integrations/dsh/bundle.rs:468
let app_source_str = app_source.display().to_string();
let first = run_dsh_plugin(runner, binary, BUNDLE_PROFILE, &["add", &app_source_str])?;
let first_ok = first.success;
let first_excerpt = first.output_excerpt.clone();
outcomes.push(first);
if !first_ok {
anyhow::bail!(
"dsh plugin add {} failed: {}",
app.package_name(),
first_excerpt
);
}
let bundle_str = bundle_dir.display().to_string();
let second = run_dsh_plugin(runner, binary, BUNDLE_PROFILE, &["add", &bundle_str])?;
let second_ok = second.success;
let second_excerpt = second.output_excerpt.clone();
outcomes.push(second);
if !second_ok {
anyhow::bail!("dsh plugin add {BUNDLE_PACKAGE_NAME} failed: {second_excerpt}");
}
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],
)?;View on GitHub (pinned to 73e0f67d83)