Hmbown/CodeWhale · error

config export requires --portable; plain export is not…

Error message

config export requires --portable; plain export is not defined yet

What it means

run_export only implements the portable export mode; calling `config export` without --portable is rejected because plain (non-portable) export semantics are not defined — exporting machine-local config verbatim would produce a bundle that fails portable import elsewhere.

Solutions

  1. Add `--portable` to the export command.
  2. Add `--project` alongside --portable if a workspace-scoped bundle is wanted.
  3. Check `codewhale config export --help` for the currently supported flags.

Example fix

// before
codewhale config export > bundle.toml
// after
codewhale config export --portable > bundle.toml
Defensive patterns

Strategy: validation

Validate before calling

if !export_args.portable { eprintln!("config export requires --portable"); std::process::exit(2); }

Try / catch

match run_export(&args, &store) {
    Err(e) if e.to_string().contains("requires --portable") => {
        eprintln!("re-run with: config export --portable");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running `codewhale config export` (optionally with --project) while omitting the --portable flag; ExportArgs.portable is false.

Common situations: Following older docs or muscle memory from other tools where plain `export` works; scripting export without reading current CLI help after the flag became mandatory.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/cbcdae822eb7b801. Report an issue: GitHub.

Appendix: source

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

        println!("nothing to apply; config already matches the bundle (idempotent re-import)");
        return Ok(());
    }
    println!(
        "imported: {} added, {} changed into {}",
        receipt.plan.added.len(),
        receipt.plan.changed.len(),
        receipt.target.display()
    );
    if let Some(backup) = &receipt.backup_path {
        println!("pre-import backup: {}", backup.display());
    }
    Ok(())
}

/// Run `config export --portable`.
pub fn run_export(args: &ExportArgs, store: &codewhale_config::ConfigStore) -> Result<()> {
    if !args.portable {
        bail!("config export requires --portable; plain export is not defined yet");
    }
    let scope = if args.project {
        BundleScope::Project
    } else {
        BundleScope::Global
    };
    validate_scope_target(scope, store.path())?;
    let metadata = BundleMetadata {
        name: None,
        created_at: Some(chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true)),
        generator: Some(format!("codewhale {}", env!("CARGO_PKG_VERSION"))),
    };
    let bundle = export_bundle(&store.config, scope, metadata)?;
    let body = serialize_bundle(&bundle)?;
    match &args.out {
        Some(path) => {
            codewhale_config::persistence::atomic_write(path, body.as_bytes())
                .with_context(|| format!("writing bundle to {}", path.display()))?;

View on GitHub (pinned to 73e0f67d83)