Hmbown/CodeWhale · error · anyhow::Error
Unrecognized --provider
Error message
Unrecognized --provider {provider_arg:?}. Known providers: {} or a configured [providers.<name>] custom provider What it means
The `--provider` CLI flag only accepts values that ApiProvider::parse recognizes (built-in providers) or names that match a configured `[providers.<name>]` custom provider. Any other string bails with the list of known providers.
Solutions
- Run with a valid built-in provider name from the Known providers hint
- Add a `[providers.<name>]` section to your config for the custom provider, then retry
- Check spelling/case of the --provider value against the hint list
Example fix
// before codewhale --provider openai-chat ... // after codewhale --provider openai ... # or add [providers.openai-chat] to the config
Defensive patterns
Strategy: validation
Validate before calling
// pre-check the value before invoking the CLI // valid = builtin provider name or a table present in config: [providers.<name>]
Try / catch
match run_result { Err(e) if e.to_string().contains("Unrecognized --provider") => { eprintln!("{}", e); /* surface hint and exit non-zero */ }, other => other? } Prevention
- Copy provider names from the Known providers hint verbatim
- Define [providers.<name>] in config before referencing a custom provider
- Validate provider names in scripts against a fixed allowlist
When it happens
Trigger: Running `codewhale --provider <name> ...` where <name> is misspelled, not a built-in provider, and has no matching `[providers.<name>]` table in the config file.
Common situations: Typo in provider name; using a provider's marketing name instead of its configured id; forgetting to add the [providers.<name>] section before passing a custom provider on the CLI; case-sensitivity mismatches.
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
- `speech` requires provider = "xiaomi-mimo
- account_agent_model_unconfigured
- Antigravity is a retired, non-runnable legacy provider…
- Antigravity is a retired, non-runnable legacy provider…
- Antigravity is a retired, non-runnable legacy provider…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/836bd139d49714f9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/lib.rs:925
fn apply_exec_provider_override(config: &mut Config, provider_arg: &str) -> Result<()> {
let provider_arg = provider_arg.trim();
if provider_arg.is_empty() {
return Ok(());
}
if config
.providers
.as_ref()
.and_then(|providers| providers.custom_provider_config(provider_arg))
.is_some()
{
config.provider = Some(provider_arg.to_string());
return Ok(());
}
if let Some(provider) = crate::config::ApiProvider::parse(provider_arg) {
config.provider = Some(provider.as_str().to_string());
return Ok(());
}
bail!(
"Unrecognized --provider {provider_arg:?}. Known providers: {} \
or a configured [providers.<name>] custom provider",
crate::config::ApiProvider::names_hint()
);
}
fn exec_model_env_override() -> Option<String> {
let read = || {
["CODEWHALE_MODEL", "DEEPSEEK_MODEL"]
.into_iter()
.find_map(|key| {
std::env::var(key)
.ok()
.map(|model| model.trim().to_string())
.filter(|model| !model.is_empty())
})
};
#[cfg(test)]View on GitHub (pinned to 73e0f67d83)