{"record":{"id":"44c3d621a4d672e7","repo":"Hmbown/CodeWhale","slug":"does-not-declare-dsh-bundle-patch-cannot-link","errorCode":null,"errorMessage":"{} does not declare dsh.bundle.patch; cannot link it as a profile bundle","messagePattern":"(.+?) does not declare dsh\\.bundle\\.patch; cannot link it as a profile bundle","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/bundle.rs","lineNumber":198,"sourceCode":"        && 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!(\n        \"{codewhale_version}+dsh.{}\",\n        &patch_sha256[..12.min(patch_sha256.len())]\n    )\n}\n\n/// Identity overlay plus the optional skin insert row. The `--patch` overlay\n/// file is never this text — only the dedicated profile's `cordis.patch.yml`.\npub(crate) fn render_bundle_patch(overlay_text: &str, skin: bool) -> String {\n    if !skin {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/dsh/bundle.rs#L180-L216","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the app package actually declares `dsh.bundle.patch` in its package.json","Reinstall the app so node_modules has the correct version: `npm ci` in the app project","Point the installer at the correct dsh-compatible app package","If you are the app author, add the dsh.bundle.patch declaration to package.json"],"exampleFix":"// before (package.json)\n{\n  \"name\": \"my-app\"\n}\n// after\n{\n  \"name\": \"my-app\",\n  \"dsh\": { \"bundle\": { \"patch\": \"patch.json\" } }\n}","handlingStrategy":"validation","validationCode":"let manifest = std::fs::read_to_string(dir.join(\"package.json\"))?;\nif !(manifest.contains(\"\\\"bundle\\\"\") && manifest.contains(\"\\\"patch\\\"\")) {\n    eprintln!(\"{} is not a dsh bundle app\", dir.display());\n}","typeGuard":"fn is_dsh_bundle_app(dir: &Path) -> bool {\n    std::fs::read_to_string(dir.join(\"package.json\"))\n        .map(|m| m.contains(\"\\\"bundle\\\"\") && m.contains(\"\\\"patch\\\"\"))\n        .unwrap_or(false)\n}","tryCatchPattern":"match install_into_profile(...) {\n    Err(e) if e.to_string().contains(\"does not declare dsh.bundle.patch\") => {\n        eprintln!(\"target app is not a dsh bundle\");\n    }\n    r => r?,\n}","preventionTips":["Confirm the target package documents dsh.bundle.patch support before installing","Run npm ci to ensure node_modules matches the lockfile","Keep dsh-compatible app packages listed in your setup docs"],"tags":["manifest","validation","dsh-bundle"],"backgroundTag":"missing-required-config-field","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"}