{"record":{"id":"4f420f7502a39030","repo":"Hmbown/CodeWhale","slug":"cannot-locate-the-installed-dsh-package-root-from","errorCode":null,"errorMessage":"cannot locate the installed dsh package root from {}","messagePattern":"cannot locate the installed dsh package root from (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/bundle.rs","lineNumber":189,"sourceCode":"        .parent()?\n        .join(\"node_modules\")\n        .join(\"@deepseek-ai\")\n        .join(\"dsh\");\n    is_dsh_package_root(&sibling).then_some(sibling)\n}\n\nfn is_dsh_package_root(dir: &Path) -> bool {\n    dir.join(\"package.json\").is_file()\n        && std::fs::read_to_string(dir.join(\"package.json\"))\n            .ok()\n            .is_some_and(|text| text.contains(\"\\\"@deepseek-ai/dsh\\\"\"))\n}\n\n/// The shipped app bundle directory inside the installed launcher, if it\n/// declares `dsh.bundle.patch`.\npub(crate) fn app_bundle_source(binary: &Path, app: DshAppBundle) -> Result<PathBuf> {\n    let root = launcher_package_root(binary).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"cannot locate the installed dsh package root from {}\",\n            binary.display()\n        )\n    })?;\n    let dir = root.join(\"node_modules\").join(app.package_name());\n    let manifest = std::fs::read_to_string(dir.join(\"package.json\"))\n        .with_context(|| format!(\"read {}\", dir.join(\"package.json\").display()))?;\n    if !manifest.contains(\"\\\"bundle\\\"\") || !manifest.contains(\"\\\"patch\\\"\") {\n        anyhow::bail!(\n            \"{} does not declare dsh.bundle.patch; cannot link it as a profile bundle\",\n            dir.display()\n        );\n    }\n    Ok(dir)\n}\n\npub(crate) fn bundle_version(codewhale_version: &str, patch_sha256: &str) -> String {\n    format!(","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/dsh/bundle.rs#L171-L207","documentation":"`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`.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Reinstall dsh using the supported package layout so `node_modules/<pkg>` exists under the package root.","Check the installed dsh version — upgrade/downgrade if the layout changed.","Report/inspect `launcher_package_root` expectations if a legitimately supported install still fails."],"exampleFix":"// before: binary is a symlink into /usr/local/bin, package root unfindable\nlet source = app_bundle_source(Path::new(\"/usr/local/bin/dsh\"), app)?;\n// after: resolve real path first, then map\nlet real = std::fs::canonicalize(\"/usr/local/bin/dsh\")?;\nlet source = app_bundle_source(&real, app)?;","handlingStrategy":"validation","validationCode":"let real = std::fs::canonicalize(binary)?;\nif launcher_package_root(&real).is_none() {\n    eprintln!(\"{} is not inside a dsh package install\", real.display());\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install dsh via the supported package layout (npm-style tree)","Resolve symlinks to the real binary before relying on detection","Verify `node_modules/<pkg>/package.json` exists under the install root after upgrades"],"tags":["dsh","path-resolution","bundle-install"],"backgroundTag":"resource-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"}