Hmbown/CodeWhale · error · anyhow
bundle at has kind ; expected
Error message
bundle at {source} has kind {:?}; expected {BUNDLE_KIND:?} What it means
`validate_bundle` checks that a parsed `PortableBundle` has `kind == BUNDLE_KIND`, the single bundle type this build understands. A mismatch bails with the actual kind and the expected value. The kind is read from the bundle document itself, so this fires when the JSON parses but is not a Codewhale config bundle of the expected type.
Solutions
- Export a fresh bundle with the matching `codewhale` command so `kind` equals `BUNDLE_KIND`.
- Fix the `kind` field in the JSON if it was accidentally edited, matching the expected value shown in the error.
- Confirm you are importing the right artifact — the file may be from a different tool or a different bundle type.
Example fix
// before
{ "kind": "other-bundle", ... }
// after
{ "kind": "<BUNDLE_KIND value from the error>", ... } Defensive patterns
Strategy: validation
Validate before calling
let doc: serde_json::Value = serde_json::from_str(&text)?;
if doc.get("kind").and_then(|k| k.as_str()) != Some("<BUNDLE_KIND>") {
// wrong artifact; refuse before handing to the parser
} Prevention
- Only import bundles produced by the matching `codewhale` export command.
- Do not hand-edit the `kind` field of exported bundles.
- Label exported files clearly so unrelated JSON files are not mistaken for bundles.
When it happens
Trigger: Calling `parse_bundle_str` (via `parse_bundle_bytes`/import) with a JSON document whose top-level `kind` field differs from `BUNDLE_KIND` — e.g. an unrelated JSON export, a bundle from a different tool, or a hand-edited file that changed `kind`.
Common situations: Importing a config file instead of an exported bundle; importing another product's bundle; manually editing the bundle and corrupting the `kind` field.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- bundle at is bytes; the limit is bytes
- --input-json must be a JSON object
- API key name must be 1
- --attempts must be an integer from 1 to 20
- bad channel slug
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/4a72a2c740519d08.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/config_bundles.rs:231
}
Ok(())
}
}
let mut deserializer = serde_json::Deserializer::from_str(text);
let mut path = Vec::new();
NoDuplicates { path: &mut path }
.deserialize(&mut deserializer)
.map_err(|error| anyhow::anyhow!("{error}"))?;
deserializer
.end()
.map_err(|error| anyhow::anyhow!("{error}"))?;
Ok(())
}
fn validate_bundle(bundle: &PortableBundle, source: &str) -> Result<()> {
if bundle.kind != BUNDLE_KIND {
bail!(
"bundle at {source} has kind {:?}; expected {BUNDLE_KIND:?}",
bundle.kind
);
}
if bundle.schema_version != BUNDLE_SCHEMA_VERSION {
bail!(
"bundle at {source} has schema_version {}; this build understands {BUNDLE_SCHEMA_VERSION}",
bundle.schema_version
);
}
Ok(())
}
// ---------------------------------------------------------------------------
// Secret rejection
// ---------------------------------------------------------------------------
/// One rejected entry: the dotted key path and the reason. Values are neverView on GitHub (pinned to 433685b202)