Hmbown/CodeWhale · error

bundle contains conflicting or rejected entries

Error message

bundle contains conflicting or rejected entries: {}; remove duplicate keys or credential-shaped entries and re-export

What it means

apply_prepared_bundle aborts the import before any write when the prepared plan contains conflicting or rejected entries (plan.conflicting non-empty). Conflicts arise from duplicate keys or entries the importer rejects (credential-shaped or redaction placeholders), and the message tells the user to fix the bundle at the source and re-export rather than importing a partially-merged document.

Solutions

  1. Read the comma-separated key list in the error; remove the duplicate or credential-shaped entries from the bundle TOML.
  2. Re-export the bundle from a clean source config so rejected entries are absent.
  3. If duplicates came from hand-merging, keep exactly one copy of each conflicting key and re-run the import.
  4. Use a dry-run import first to see the conflict plan before applying.

Example fix

// before (bundle.toml)
[global]
model = "a"
[global]
model = "b"
// after
[global]
model = "b"
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: run the dry-run import and inspect the plan before applying
// codewhale bundle import team.toml --dry-run
// Ensure the printed plan has no 'conflicting' entries before applying.

Type guard

fn import_is_clean(plan: &ImportPlan) -> bool {
    plan.conflicting.is_empty()
}

Try / catch

match apply_prepared_bundle(prepared, &target, apply) {
    Err(e) if e.to_string().contains("conflicting or rejected entries") => {
        eprintln!("fix the bundle and re-export: {e:#}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: apply_bundle/run_import invoked on a bundle whose entries collide with each other or include rejected credential-shaped keys; the plan builder collected those keys into plan.conflicting, and apply_prepared_bundle bails before touching the ConfigStore.

Common situations: Hand-merging two bundle TOML files and leaving duplicate top-level keys; exporting a bundle from a machine whose config still contains API keys; concatenating bundles with copy/paste duplication.

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/c69caf100983900e. Report an issue: GitHub.

Appendix: source

Thrown at crates/cli/src/config_bundles.rs:1059

    apply_prepared_bundle(prepared, store, save_candidate)
}

struct PreparedImport {
    plan: ImportPlan,
    candidate: ConfigToml,
}

fn apply_prepared_bundle<F>(
    prepared: PreparedImport,
    store: &mut codewhale_config::ConfigStore,
    apply: F,
) -> Result<ImportReceipt>
where
    F: FnOnce(ConfigToml, &mut codewhale_config::ConfigStore, &mut bool) -> Result<()>,
{
    let PreparedImport { plan, candidate } = prepared;
    if !plan.conflicting.is_empty() {
        bail!(
            "bundle contains conflicting or rejected entries: {}; remove duplicate keys or credential-shaped entries and re-export",
            plan.conflicting.join(", ")
        );
    }
    if plan.is_no_op() {
        return Ok(ImportReceipt {
            plan,
            backup_path: None,
            target: store.path().to_path_buf(),
        });
    }

    let target = store.path().to_path_buf();
    let original_config = store.config.clone();
    let backup_path = if target
        .try_exists()
        .with_context(|| format!("checking config target {}", target.display()))?
    {

View on GitHub (pinned to 73e0f67d83)