Hmbown/CodeWhale · error

does not declare dsh.bundle.patch; cannot link it as a…

Error message

{} does not declare dsh.bundle.patch; cannot link it as a profile bundle

What it means

app_bundle_source locates a dsh plugin app inside node_modules and verifies its package.json declares the `dsh.bundle.patch` capability before it can be linked as a profile bundle. If the manifest lacks the expected bundle/patch keys, install_into_profile cannot safely link it, so this bail fires naming the app directory. It guards against treating an ordinary npm package as a dsh bundle.

Solutions

  1. Verify the app package actually declares `dsh.bundle.patch` in its package.json
  2. Reinstall the app so node_modules has the correct version: `npm ci` in the app project
  3. Point the installer at the correct dsh-compatible app package
  4. If you are the app author, add the dsh.bundle.patch declaration to package.json

Example fix

// before (package.json)
{
  "name": "my-app"
}
// after
{
  "name": "my-app",
  "dsh": { "bundle": { "patch": "patch.json" } }
}
Defensive patterns

Strategy: validation

Validate before calling

let manifest = std::fs::read_to_string(dir.join("package.json"))?;
if !(manifest.contains("\"bundle\"") && manifest.contains("\"patch\"")) {
    eprintln!("{} is not a dsh bundle app", dir.display());
}

Type guard

fn is_dsh_bundle_app(dir: &Path) -> bool {
    std::fs::read_to_string(dir.join("package.json"))
        .map(|m| m.contains("\"bundle\"") && m.contains("\"patch\""))
        .unwrap_or(false)
}

Try / catch

match install_into_profile(...) {
    Err(e) if e.to_string().contains("does not declare dsh.bundle.patch") => {
        eprintln!("target app is not a dsh bundle");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling install_into_profile with an app whose node_modules/<pkg>/package.json does not contain the `bundle`/`patch` fields dsh requires; or the manifest is for a different, non-dsh package.

Common situations: Pointing the bundle installer at a regular npm package; the app author removed or renamed dsh.bundle.patch; node_modules contains a stale or wrong package under the expected package_name.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

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

        && 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!(
        "{codewhale_version}+dsh.{}",
        &patch_sha256[..12.min(patch_sha256.len())]
    )
}

/// Identity overlay plus the optional skin insert row. The `--patch` overlay
/// file is never this text — only the dedicated profile's `cordis.patch.yml`.
pub(crate) fn render_bundle_patch(overlay_text: &str, skin: bool) -> String {
    if !skin {

View on GitHub (pinned to 73e0f67d83)