{"record":{"id":"4a72a2c740519d08","repo":"Hmbown/CodeWhale","slug":"bundle-at-source-has-kind-expected-bundle-kind","errorCode":null,"errorMessage":"bundle at {source} has kind {:?}; expected {BUNDLE_KIND:?}","messagePattern":"bundle at (.+?) has kind (.+?); expected (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":231,"sourceCode":"            }\n            Ok(())\n        }\n    }\n\n    let mut deserializer = serde_json::Deserializer::from_str(text);\n    let mut path = Vec::new();\n    NoDuplicates { path: &mut path }\n        .deserialize(&mut deserializer)\n        .map_err(|error| anyhow::anyhow!(\"{error}\"))?;\n    deserializer\n        .end()\n        .map_err(|error| anyhow::anyhow!(\"{error}\"))?;\n    Ok(())\n}\n\nfn validate_bundle(bundle: &PortableBundle, source: &str) -> Result<()> {\n    if bundle.kind != BUNDLE_KIND {\n        bail!(\n            \"bundle at {source} has kind {:?}; expected {BUNDLE_KIND:?}\",\n            bundle.kind\n        );\n    }\n    if bundle.schema_version != BUNDLE_SCHEMA_VERSION {\n        bail!(\n            \"bundle at {source} has schema_version {}; this build understands {BUNDLE_SCHEMA_VERSION}\",\n            bundle.schema_version\n        );\n    }\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// Secret rejection\n// ---------------------------------------------------------------------------\n\n/// One rejected entry: the dotted key path and the reason. Values are never","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L213-L249","documentation":"A portable config bundle was parsed successfully, but its `kind` field does not match the `BUNDLE_KIND` constant this build of the CLI supports. The CLI only imports bundles of the exact expected kind so it never misinterprets a bundle written for another subsystem. Thrown by `validate_bundle` in crates/cli/src/config_bundles.rs during `parse_bundle_str`, before any bundle content is applied.","triggerScenarios":"Calling `codewhale config bundle import` (via `parse_bundle_str` -> `validate_bundle`) with a bundle file whose top-level `kind` field differs from BUNDLE_KIND — e.g. a bundle produced by a different tool or a future/other bundle type.","commonSituations":"Downloading a bundle from a third party that is actually a different bundle type; editing a bundle's `kind` by hand; a repo/tooling version drift where a bundle was exported by a component writing a different kind.","solutions":["Open the bundle file and check its `kind` field; re-export the bundle from the matching codewhale CLI with `config bundle export`.","Upgrade (or downgrade) the CLI to the build that understands this bundle kind.","If the bundle is hand-maintained, correct the `kind` field to the expected value shown in the message."],"exampleFix":"// before (bundle.json)\n{ \"kind\": \"project-settings-v2\", ... }\n// after\n{ \"kind\": \"codewhale-config-bundle\", ... }  // must equal the BUNDLE_KIND this build expects","handlingStrategy":"validation","validationCode":"let bundle: serde_json::Value = serde_json::from_str(&text)?;\nif bundle.get(\"kind\").and_then(|k| k.as_str()) != Some(EXPECTED_BUNDLE_KIND) {\n    return Err(format!(\"bundle kind {:?} not supported; expected {:?}\", bundle.get(\"kind\"), EXPECTED_BUNDLE_KIND));\n}","typeGuard":"fn has_expected_kind(v: &serde_json::Value, expected: &str) -> bool {\n    v.get(\"kind\").and_then(|k| k.as_str()) == Some(expected)\n}","tryCatchPattern":null,"preventionTips":["Always re-export bundles with the same CLI build that will import them.","Validate a downloaded bundle's `kind` field before importing.","Never hand-edit the `kind` field of a bundle."],"tags":["config-bundle","validation","cli"],"backgroundTag":"schema-validation-failed","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}