Hmbown/CodeWhale · error

--set is per-run and never saved; it cannot be combined…

Error message

--set is per-run and never saved; it cannot be combined with `config set`, `config unset`, or `config import`. Drop --set, or use a read command.

What it means

`--set` values are per-run overlays that are never persisted; to protect that contract, config commands that write the store (set, unset, import, telemetry notice acceptance) refuse to run when --set is present. The error explains that --set must be dropped or a read command used.

Solutions

  1. Split the invocation: run the per-run command with --set, and `config set` without --set
  2. Drop --set if the intent was to persist values via `config set`
  3. Use a read command (e.g. `config get`) if only inspection was intended alongside --set

Example fix

// before
codewhale config --set temperature=0.2 config set model gpt-5
// after
codewhale config set model gpt-5
codewhale --set temperature=0.2 exec "..."
Defensive patterns

Strategy: validation

Validate before calling

if has_set_overrides && [[ "$subcmd" == set || "$subcmd" == unset || "$subcmd" == import ]]; then echo "split: run --set separately from config writes"; exit 1; fi

Prevention

When it happens

Trigger: Invoking e.g. `codewhale config --set model=x config set other=y` — any write-shaped ConfigCommand (Set, Unset, Import, Telemetry with accept_notice) combined with per-run --set overrides.

Common situations: Scripts that always append --set flags for run-configuration and reuse them for `config set`; users expecting --set to persist; combining a one-off override with a permanent change in one command.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at crates/cli/src/lib.rs:4492

        bail!(
            "--project requires a workspace config ({} is the user-global document)",
            store.path().display()
        );
    }
    // A per-run overlay must never leak into the file: commands that write
    // the store refuse it outright instead of saving a merged document.
    if !per_run_overrides.is_empty()
        && matches!(
            command,
            ConfigCommand::Set { .. }
                | ConfigCommand::Unset { .. }
                | ConfigCommand::Import(_)
                | ConfigCommand::Telemetry {
                    accept_notice: Some(_)
                }
        )
    {
        bail!(
            "--set is per-run and never saved; it cannot be combined with `config set`, \
             `config unset`, or `config import`. Drop --set, or use a read command."
        );
    }
    match command {
        ConfigCommand::Get { key } => {
            if per_run_overrides.is_empty() && codewhale_tui::route_preferences::is_route_key(&key)
            {
                if let Some(value) = codewhale_tui::route_preferences::get(store.path(), &key)? {
                    println!("{value}");
                    return Ok(());
                }
                bail!("key not found: {key}");
            }
            if codewhale_config::notifications::in_namespace(&key) {
                let config = codewhale_config::notifications::from_extras(&store.config.extras)?;
                let keys = if key.eq_ignore_ascii_case("notifications") {
                    codewhale_config::notifications::NotificationSetting::ALL.to_vec()

View on GitHub (pinned to 73e0f67d83)