{"record":{"id":"8b529f37c5a863f9","repo":"Hmbown/CodeWhale","slug":"dsh-plugin-add-bundle-package-name-failed-seco","errorCode":null,"errorMessage":"dsh plugin add {BUNDLE_PACKAGE_NAME} failed: {second_excerpt}","messagePattern":"dsh plugin add (.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/bundle.rs","lineNumber":468,"sourceCode":"    let app_source_str = app_source.display().to_string();\n    let first = run_dsh_plugin(runner, binary, BUNDLE_PROFILE, &[\"add\", &app_source_str])?;\n    let first_ok = first.success;\n    let first_excerpt = first.output_excerpt.clone();\n    outcomes.push(first);\n    if !first_ok {\n        anyhow::bail!(\n            \"dsh plugin add {} failed: {}\",\n            app.package_name(),\n            first_excerpt\n        );\n    }\n    let bundle_str = bundle_dir.display().to_string();\n    let second = run_dsh_plugin(runner, binary, BUNDLE_PROFILE, &[\"add\", &bundle_str])?;\n    let second_ok = second.success;\n    let second_excerpt = second.output_excerpt.clone();\n    outcomes.push(second);\n    if !second_ok {\n        anyhow::bail!(\"dsh plugin add {BUNDLE_PACKAGE_NAME} failed: {second_excerpt}\");\n    }\n    Ok((app_source, outcomes))\n}\n\npub(crate) fn remove_from_profile(\n    runner: &dyn DshRunner,\n    detection: &DshDetection,\n) -> Result<PluginCommandOutcome> {\n    let binary = detection\n        .binary\n        .as_ref()\n        .ok_or_else(|| anyhow::anyhow!(\"dsh binary is unknown\"))?;\n    let outcome = run_dsh_plugin(\n        runner,\n        binary,\n        BUNDLE_PROFILE,\n        &[\"remove\", BUNDLE_PACKAGE_NAME],\n    )?;","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/dsh/bundle.rs#L450-L486","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n// second add fails on leftover plugin entry\ncodewhale dsh install-bundle\n// after\ncodewhale dsh remove-bundle\ncodewhale dsh install-bundle  # clean lifecycle retry","handlingStrategy":"try-catch","validationCode":"// ensure no stale bundle entry before installing\nlet out = std::process::Command::new(\"dsh\").args([\"plugin\", \"list\"]).output()?;\nif String::from_utf8_lossy(&out.stdout).contains(\"codewhale-bundle\") {\n    eprintln!(\"stale bundle present; run remove-bundle first\");\n}","typeGuard":"fn bundle_clean(dsh_list_output: &str, bundle_name: &str) -> bool {\n    !dsh_list_output.contains(bundle_name)\n}","tryCatchPattern":"match install_into_profile(...) {\n    Err(e) if e.to_string().contains(\"codewhale-bundle\") => {\n        remove_from_profile_then_retry()?;\n    }\n    r => r?,\n}","preventionTips":["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"],"tags":["external-command","dsh-plugin","bundle"],"backgroundTag":"command-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}