{"record":{"id":"c69caf100983900e","repo":"Hmbown/CodeWhale","slug":"bundle-contains-conflicting-or-rejected-entries-remove","errorCode":null,"errorMessage":"bundle contains conflicting or rejected entries: {}; remove duplicate keys or credential-shaped entries and re-export","messagePattern":"bundle contains conflicting or rejected entries: (.+?); remove duplicate keys or credential-shaped entries and re-export","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/config_bundles.rs","lineNumber":1059,"sourceCode":"    apply_prepared_bundle(prepared, store, save_candidate)\n}\n\nstruct PreparedImport {\n    plan: ImportPlan,\n    candidate: ConfigToml,\n}\n\nfn apply_prepared_bundle<F>(\n    prepared: PreparedImport,\n    store: &mut codewhale_config::ConfigStore,\n    apply: F,\n) -> Result<ImportReceipt>\nwhere\n    F: FnOnce(ConfigToml, &mut codewhale_config::ConfigStore, &mut bool) -> Result<()>,\n{\n    let PreparedImport { plan, candidate } = prepared;\n    if !plan.conflicting.is_empty() {\n        bail!(\n            \"bundle contains conflicting or rejected entries: {}; remove duplicate keys or credential-shaped entries and re-export\",\n            plan.conflicting.join(\", \")\n        );\n    }\n    if plan.is_no_op() {\n        return Ok(ImportReceipt {\n            plan,\n            backup_path: None,\n            target: store.path().to_path_buf(),\n        });\n    }\n\n    let target = store.path().to_path_buf();\n    let original_config = store.config.clone();\n    let backup_path = if target\n        .try_exists()\n        .with_context(|| format!(\"checking config target {}\", target.display()))?\n    {","sourceCodeStart":1041,"sourceCodeEnd":1077,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/config_bundles.rs#L1041-L1077","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the comma-separated key list in the error; remove the duplicate or credential-shaped entries from the bundle TOML.","Re-export the bundle from a clean source config so rejected entries are absent.","If duplicates came from hand-merging, keep exactly one copy of each conflicting key and re-run the import.","Use a dry-run import first to see the conflict plan before applying."],"exampleFix":"// before (bundle.toml)\n[global]\nmodel = \"a\"\n[global]\nmodel = \"b\"\n// after\n[global]\nmodel = \"b\"","handlingStrategy":"validation","validationCode":"// Pre-flight: run the dry-run import and inspect the plan before applying\n// codewhale bundle import team.toml --dry-run\n// Ensure the printed plan has no 'conflicting' entries before applying.","typeGuard":"fn import_is_clean(plan: &ImportPlan) -> bool {\n    plan.conflicting.is_empty()\n}","tryCatchPattern":"match apply_prepared_bundle(prepared, &target, apply) {\n    Err(e) if e.to_string().contains(\"conflicting or rejected entries\") => {\n        eprintln!(\"fix the bundle and re-export: {e:#}\");\n    }\n    other => other?,\n}","preventionTips":["Always dry-run imports before applying.","Never hand-merge bundle TOML files; re-export from a single source of truth.","Keep credentials out of source configs so exports are rejection-free."],"tags":["import","validation","conflict","config-bundles","toml"],"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-22T10:30:35.592Z"}