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 enforces scope separation: a Global-scope import refuses a bundle that contains [project] entries, directing the user to run the import with --project from inside the workspace. This prevents project-specific configuration from being written into (or silently dropped from) the global document, and the sibling Project-scope check prevents the reverse leak.
Solutions
- Re-run the import with --project from within the target workspace so [project] entries land in the project document.
- Strip the [project] section from the bundle if you truly only want the global entries.
- Split the bundle: export global and project scopes separately and import each into its matching scope.
- cd into the workspace root first — project scope imports require being in the workspace.
Example fix
// before codewhale bundle import team.toml // after cd /path/to/workspace codewhale bundle import team.toml --project
Defensive patterns
Strategy: validation
Validate before calling
// Check the bundle's scopes before choosing import flags: // grep -n '^\[project\]' team.toml # non-empty [project] requires --project // grep -n '^\[global\]' team.toml # non-empty [global] conflicts with --project
Type guard
fn bundle_matches_scope(b: &PortableBundle, scope: BundleScope) -> bool {
match scope {
BundleScope::Global => b.project.entries.is_empty(),
BundleScope::Project => b.global.entries.is_empty(),
}
} Prevention
- Match the import flag to the bundle's sections: [project] needs --project, [global] needs global scope.
- cd into the workspace before project-scope imports.
- Export global and project bundles separately so each imports into one scope.
When it happens
Trigger: Running `codewhale bundle import` (global scope, the default) on a bundle whose TOML contains a non-empty [project] table; prepare_import inspects bundle.project.entries and bails before planning any writes.
Common situations: Sharing a bundle exported with both global and project sections and importing it globally; forgetting the --project flag; running the command outside the workspace so project scope wasn't selectable.
Related errors
- bundle contains conflicting or rejected entries
- ; ROLLBACK FAILED — the pre-import document is preserved at
- ; rolled back to the pre-import document
- import cancelled; no configuration was changed
- import refused: non-interactive use requires explicit --yes…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/16d8949b7b45fa49.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/config_bundles.rs:1146
}
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() {
originalView on GitHub (pinned to 73e0f67d83)