Hmbown/CodeWhale · error

bundle at has kind ; expected

Error message

bundle at {source} has kind {:?}; expected {BUNDLE_KIND:?}

What it means

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.

Solutions

  1. Open the bundle file and check its `kind` field; re-export the bundle from the matching codewhale CLI with `config bundle export`.
  2. Upgrade (or downgrade) the CLI to the build that understands this bundle kind.
  3. If the bundle is hand-maintained, correct the `kind` field to the expected value shown in the message.

Example fix

// before (bundle.json)
{ "kind": "project-settings-v2", ... }
// after
{ "kind": "codewhale-config-bundle", ... }  // must equal the BUNDLE_KIND this build expects
Defensive patterns

Strategy: validation

Validate before calling

let bundle: serde_json::Value = serde_json::from_str(&text)?;
if bundle.get("kind").and_then(|k| k.as_str()) != Some(EXPECTED_BUNDLE_KIND) {
    return Err(format!("bundle kind {:?} not supported; expected {:?}", bundle.get("kind"), EXPECTED_BUNDLE_KIND));
}

Type guard

fn has_expected_kind(v: &serde_json::Value, expected: &str) -> bool {
    v.get("kind").and_then(|k| k.as_str()) == Some(expected)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). 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 never

View on GitHub (pinned to 73e0f67d83)