Hmbown/CodeWhale · error
invalid value ' ' for '--provider ': expected one of …
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
`top_level_provider_override` fails when `--provider` receives a value that is neither a builtin `ProviderKind` nor a legacy antigravity selector, on a command that does not accept raw provider ids. Raw/custom provider ids are restricted to the `exec` and `fleet` subcommands, so everywhere else only builtin provider names are legal.
Solutions
- Use a builtin provider name listed in the error's `expected one of {expected}` hint.
- Move the custom provider usage to the `exec` or `fleet` subcommand, which are the only commands accepting raw provider ids.
- Fix the spelling of the provider name in the command line or script.
Example fix
// before codewhale --provider my-custom "do work" // after codewhale exec --provider my-custom "do work"
Defensive patterns
Strategy: validation
Validate before calling
const BUILTIN = new Set(['openai','anthropic']); // see ProviderKind::names_hint()
const RAW_OK = ['exec','fleet'];
if (!BUILTIN.has(provider) && !RAW_OK.includes(subcommand)) throw new Error(`custom provider '${provider}' only allowed via exec/fleet`); Prevention
- Validate `--provider` against the hint list before invoking.
- Route custom providers exclusively through exec/fleet subcommands.
When it happens
Trigger: `codewhale --provider my-custom-provider ...` on any command where `command_accepts_raw_provider` is false; misspelling a builtin name (e.g. `--provider antropic`); using a custom provider id configured in config files at the top level instead of via exec/fleet.
Common situations: Typo'd provider names; users assuming their configured custom providers work everywhere; old scripts using a custom id at top level after the exec/fleet-only restriction was introduced.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- Antigravity is a retired, non-runnable legacy provider…
- Choose one input source, an unused --output path (or…
- --days must be an integer from 1 through 90
- duration resolved to zero seconds
- ` ` is not a valid provider id. Ids are 1-64 characters of…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/028f60de649763ac.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/lib.rs:537
fn top_level_provider_override(
provider: Option<&str>,
command: Option<&Commands>,
) -> Result<Option<ProviderKind>> {
let Some(provider) = provider else {
return Ok(None);
};
if is_antigravity_legacy_selector(provider) {
bail!(codewhale_config::LEGACY_ANTIGRAVITY_TOMBSTONE_MESSAGE);
}
if let Some(provider) = builtin_provider_arg(provider) {
return Ok(Some(provider));
}
if command_accepts_raw_provider(command) {
return Ok(None);
}
let expected = ProviderKind::names_hint();
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 73e0f67d83)