Hmbown/CodeWhale · error

invalid runtime --set: value must not be empty

Error message

invalid runtime --set: value must not be empty

What it means

After a supported `--set` key is matched, `apply_runtime_set_overrides` validates that the value is non-empty (`value.trim().is_empty()`). Empty values are rejected because an empty string would be written into the config/runtime override and silently disable or corrupt the setting. This typically results from `--set key=` with nothing after the equals sign or an unexpanded shell variable.

Solutions

  1. Supply a concrete value after the `=`: `--set model=gpt-x`.
  2. If using a shell variable, check it is set before invoking: `${MODEL:?MODEL is not set}` or a guard in the script.
  3. Remove the `--set` flag entirely if you meant to keep the configured default.

Example fix

// before (shell)
codewhale --set model="$MODEL" exec "hi"   # MODEL unset
// error: invalid runtime --set: value must not be empty

// after
codewhale --set model="${MODEL:?MODEL is not set}" exec "hi"
Defensive patterns

Strategy: validation

Validate before calling

# shell guard before invoking
: "${MODEL:?MODEL must be set}"
codewhale --set model="$MODEL" exec "hi"

Try / catch

match run(args) {
    Err(e) if e.to_string().contains("value must not be empty") => {
        eprintln!("--set value was empty; check the source variable");
    }
    r => r?,
}

Prevention

When it happens

Trigger: Passing `--set model=`, `--set provider="$PROVIDER"` where `$PROVIDER` is unset/empty, or any `--set key=<whitespace>`.

Common situations: Unset environment variables in shell scripts (`--set model="$MODEL"`), copy-paste dropping the value, templating tools substituting an empty string, or hand-edited command lines.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

            "model" | "default_text_model" => values.model = Some(value.to_string()),
            "verbosity" => values.verbosity = Some(value.to_string()),
            "approval_policy" => values.approval_policy = Some(value.to_string()),
            "sandbox_mode" => values.sandbox_mode = Some(value.to_string()),
            "telemetry" => {
                let mut config = ConfigToml::default();
                config
                    .set_value("telemetry", value)
                    .map_err(|_| anyhow!("invalid --set telemetry: expected a boolean"))?;
                values.telemetry = config.telemetry;
            }
            _ => bail!(
                "unsupported runtime --set key (value omitted): supported keys are provider, \
                 model, default_text_model, verbosity, approval_policy, sandbox_mode and \
                 telemetry; use the dedicated option or config set for other keys"
            ),
        }
        if value.trim().is_empty() {
            bail!("invalid runtime --set: value must not be empty");
        }
    }
    // A dedicated flag is more specific than a generic --set for the same
    // field. Repeated --set keys otherwise keep their last value.
    cli.provider = cli.provider.take().or(provider);
    cli.model = cli.model.take().or(values.model);
    cli.verbosity = cli.verbosity.take().or(values.verbosity);
    cli.approval_policy = cli.approval_policy.take().or(values.approval_policy);
    cli.sandbox_mode = cli.sandbox_mode.take().or(values.sandbox_mode);
    cli.telemetry = cli.telemetry.or(values.telemetry);
    Ok(())
}

fn run() -> Result<()> {
    let matches = Cli::command().get_matches();
    let project_bundle_scope = config_command_targets_project(&matches);
    let mut cli = Cli::from_arg_matches(&matches).unwrap_or_else(|error| error.exit());

View on GitHub (pinned to 73e0f67d83)