Hmbown/CodeWhale · error

cannot locate the installed dsh package root from

Error message

cannot locate the installed dsh package root from {}

What it means

`app_bundle_source` walks up from the dsh binary path to find the installed launcher's package root (needed to reach `node_modules/<package>/package.json`). It throws this when `launcher_package_root(binary)` returns `None` — the parent-directory walk found no recognizable package root declaring `dsh.bundle.patch`.

Solutions

  1. Verify the dsh binary resolves to its real install location (`readlink -f $(which dsh)`); reconnect with the real path if it's a detached symlink.
  2. Reinstall dsh using the supported package layout so `node_modules/<pkg>` exists under the package root.
  3. Check the installed dsh version — upgrade/downgrade if the layout changed.
  4. Report/inspect `launcher_package_root` expectations if a legitimately supported install still fails.

Example fix

// before: binary is a symlink into /usr/local/bin, package root unfindable
let source = app_bundle_source(Path::new("/usr/local/bin/dsh"), app)?;
// after: resolve real path first, then map
let real = std::fs::canonicalize("/usr/local/bin/dsh")?;
let source = app_bundle_source(&real, app)?;
Defensive patterns

Strategy: validation

Validate before calling

let real = std::fs::canonicalize(binary)?;
if launcher_package_root(&real).is_none() {
    eprintln!("{} is not inside a dsh package install", real.display());
    return Ok(());
}

Prevention

When it happens

Trigger: Calling `app_bundle_source` (directly, or via `install_into_profile`) with a binary path whose ancestor directories contain no dsh package root — e.g. a bare symlinked binary outside an npm-style install tree, or an unexpected install layout.

Common situations: dsh installed via a non-standard method (cargo, brew, standalone download) rather than the supported npm-style layout; binary symlinked into /usr/local/bin away from its package; a dsh version that changed install layout.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

        .parent()?
        .join("node_modules")
        .join("@deepseek-ai")
        .join("dsh");
    is_dsh_package_root(&sibling).then_some(sibling)
}

fn is_dsh_package_root(dir: &Path) -> bool {
    dir.join("package.json").is_file()
        && std::fs::read_to_string(dir.join("package.json"))
            .ok()
            .is_some_and(|text| text.contains("\"@deepseek-ai/dsh\""))
}

/// The shipped app bundle directory inside the installed launcher, if it
/// declares `dsh.bundle.patch`.
pub(crate) fn app_bundle_source(binary: &Path, app: DshAppBundle) -> Result<PathBuf> {
    let root = launcher_package_root(binary).ok_or_else(|| {
        anyhow::anyhow!(
            "cannot locate the installed dsh package root from {}",
            binary.display()
        )
    })?;
    let dir = root.join("node_modules").join(app.package_name());
    let manifest = std::fs::read_to_string(dir.join("package.json"))
        .with_context(|| format!("read {}", dir.join("package.json").display()))?;
    if !manifest.contains("\"bundle\"") || !manifest.contains("\"patch\"") {
        anyhow::bail!(
            "{} does not declare dsh.bundle.patch; cannot link it as a profile bundle",
            dir.display()
        );
    }
    Ok(dir)
}

pub(crate) fn bundle_version(codewhale_version: &str, patch_sha256: &str) -> String {
    format!(

View on GitHub (pinned to 73e0f67d83)