Hmbown/CodeWhale · error

bundle carries [project] entries; import it with --project…

Error message

bundle carries [project] entries; import it with --project from the workspace instead

What it means

prepare_import rejects importing a bundle into global scope when the bundle carries [project] entries. Project entries are workspace-scoped and must be imported from inside the workspace with --project; silently merging them into the global document would put machine-local state in the wrong scope.

Solutions

  1. cd into the target workspace and re-run the import with --project.
  2. If you only want the global part, import with the default scope — the project entries are refused, so edit the bundle to remove the [project] section or accept two scoped imports.
  3. Use --dry-run to see which scope the bundle targets before applying.

Example fix

# before
codewhale config bundle import team-bundle.toml

# after
cd ~/work/myproject
codewhale config bundle import team-bundle.toml --project
Defensive patterns

Strategy: validation

Validate before calling

let bundle = read_portable_bundle(path)?;
let scope = if !bundle.project.entries.is_empty() { BundleScope::Project } else { BundleScope::Global };

Prevention

When it happens

Trigger: run_import/apply_bundle without --project (BundleScope::Global) on a bundle whose project.entries table is non-empty, i.e. the export was created with project scope or contains a [project] section.

Common situations: A teammate exported a bundle from their workspace and you import it in your home dir without --project; an exported bundle intentionally contains both scopes and you ran the default global import first.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/16d8949b7b45fa49. Report an issue: GitHub.

Appendix: source

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

    }

    match std::fs::remove_file(target) {
        Ok(()) => Ok(()),
        Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(()),
        Err(error) => Err(error)
            .with_context(|| format!("removing newly-created config {}", target.display())),
    }
}

/// Build the exact candidate used for both preview and commit. Legacy route
/// migration remains in memory until the existing ConfigStore CAS save.
fn prepare_import(
    bundle: &PortableBundle,
    store: &codewhale_config::ConfigStore,
    scope: BundleScope,
) -> Result<PreparedImport> {
    match scope {
        BundleScope::Global if !bundle.project.entries.is_empty() => bail!(
            "bundle carries [project] entries; import it with --project from the workspace instead"
        ),
        BundleScope::Project if !bundle.global.entries.is_empty() => bail!(
            "bundle carries [global] entries; importing them into a project document would leak machine state"
        ),
        _ => {}
    }
    validate_scope_target(scope, store.path())?;
    let mut plan = plan_import(bundle, &store.config, scope);
    if !plan.conflicting.is_empty() || (plan.is_no_op() && plan.skipped.is_empty()) {
        return Ok(PreparedImport {
            plan,
            candidate: store.config.clone(),
        });
    }
    let rendered;
    let original = if let Some(original) = store.original_body() {
        original

View on GitHub (pinned to 433685b202)