Hmbown/CodeWhale · error

invalid value '{provider}' for '--provider <PROVIDER>': expe

Error message

invalid value '{provider}' for '--provider <PROVIDER>': expected one of {expected}; configured custom providers are accepted only by exec and fleet

What it means

The global --provider flag accepts either a built-in provider kind (the ProviderArg enum: deepseek, nvidia-nim, openai, atlascloud, wanjie-ark, volcengine, openrouter, orcarouter, xiaomi-mimo, novita, fireworks, siliconflow, siliconflow-cn, arcee, moonshot, ...) or, only for the exec and fleet subcommands, an arbitrary configured custom provider id. Any other string on any other subcommand reaches this bail.

Source

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

    command: Option<&Commands>,
) -> Result<Option<ProviderKind>> {
    let Some(provider) = provider else {
        return Ok(None);
    };
    if let Some(provider) = builtin_provider_arg(provider) {
        return Ok(Some(provider.into()));
    }
    if command_accepts_raw_provider(command) {
        return Ok(None);
    }

    let expected = ProviderArg::value_variants()
        .iter()
        .filter_map(ValueEnum::to_possible_value)
        .map(|value| value.get_name().to_string())
        .collect::<Vec<_>>()
        .join(", ");
    bail!(
        "invalid value '{provider}' for '--provider <PROVIDER>': expected one of {expected}; configured custom providers are accepted only by exec and fleet"
    )
}

fn prepare_raw_provider_tui_dispatch(
    cli: &Cli,
    command: Option<&Commands>,
    runtime_overrides: &CliRuntimeOverrides,
) -> Result<Option<(ResolvedRuntimeOptions, Vec<String>)>> {
    let Some(provider) = cli.provider.as_deref() else {
        return Ok(None);
    };
    if builtin_provider_arg(provider).is_some() || !command_accepts_raw_provider(command) {
        return Ok(None);
    }

    let passthrough = match command {
        Some(Commands::Exec(args)) => {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Use the exec or fleet subcommand for custom provider ids: codewhale --provider my-custom exec "..."
  2. Fix the spelling/case of a built-in name: --provider deepseek, --provider openrouter, --provider siliconflow-cn
  3. List valid built-ins from the error message itself (it enumerates the expected values)
  4. Set the custom provider as default or select it inside the TUI instead of via the global flag

Example fix

# before
codewhale --provider my-custom chat
# after
codewhale --provider my-custom exec "hello"
# or, for built-ins on any command:
codewhale --provider deepseek chat
Defensive patterns

Strategy: validation

Validate before calling

fn accepts_custom_provider(command: &str) -> bool {
    matches!(command, "exec" | "fleet")
}

let builtin = ["deepseek","openai","openrouter","moonshot","fireworks","novita",
               "siliconflow","siliconflow-cn","volcengine","atlascloud",
               "wanjie-ark","nvidia-nim","orcarouter","xiaomi-mimo","arcee"];
let ok = builtin.contains(&provider) || accepts_custom_provider(subcommand);

Type guard

fn provider_ok_for_command(provider: &str, command: &str) -> bool {
    const BUILTIN: &[&str] = &["deepseek","openai","openrouter","moonshot","fireworks",
        "novita","siliconflow","siliconflow-cn","volcengine","atlascloud",
        "wanjie-ark","nvidia-nim","orcarouter","xiaomi-mimo","arcee"];
    BUILTIN.contains(&provider) || matches!(command, "exec" | "fleet")
}

Prevention

When it happens

Trigger: Running e.g. `codewhale --provider my-custom chat` or `codewhale --provider Foo tui` (typo/case mismatch) where my-custom is a user-defined provider in config: only exec and fleet forward raw provider ids; every other command rejects them.

Common situations: Users who configured a custom provider (in providers config) and try to launch the TUI/chat with it; typos or wrong case in built-in names; aliases that only exist on the value enum (e.g. silicon-flow-cn) used elsewhere; scripts written for exec reused on other subcommands.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/028f60de649763ac. Report an issue: GitHub.