Hmbown/CodeWhale · error
Invalid provider ' ': expected .
Error message
Invalid provider '{provider}': expected {}. What it means
Provider names are validated against the known ApiProvider set plus any configured custom providers. An unrecognized provider name that is not a custom provider fails with a hint listing valid names. Thrown at config.rs:5091.
Solutions
- Correct the provider name to one from the hint (ApiProvider::names_hint()).
- If it is meant to be a custom provider, define it under [providers.<name>] with custom_provider_config.
- Check for typos or stale names in env/config/scripts (e.g. retired antigravity — see error 817).
Example fix
// before provider = "googel" // after provider = "google"
Defensive patterns
Strategy: validation
Validate before calling
if ApiProvider::parse(provider).is_none() && custom_providers.get(provider).is_none() {
return Err(format!("unknown provider '{provider}'"));
} Prevention
- Keep provider names in a shared constant list, not free-typed strings.
- Define custom providers before referencing them elsewhere in config.
When it happens
Trigger: `self.provider` is set, ApiProvider::parse(provider) returns None, and providers.custom_provider_config(provider) is also None — i.e. the name matches neither a built-in nor a user-defined custom provider.
Common situations: Typo like provider = "anthrpic"; referencing a custom provider before defining it under [providers]; using a provider name from another tool's vocabulary; casing/format drift after normalization changes.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- custom provider ' ' must set [providers. ].kind =…
- Invalid default_text_model
- .context_window must be greater than 0
- .model_context_windows. must be greater than 0
- unknown field ' ' for built-in provider ' ': expected one…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/05026a7d166ed793.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/config.rs:5091
self.custom_models.as_deref().unwrap_or_default(),
)?;
self.openrouter_vendor()?;
if self
.provider
.as_deref()
.is_some_and(is_legacy_antigravity_identity)
{
anyhow::bail!(codewhale_config::LEGACY_ANTIGRAVITY_TOMBSTONE_MESSAGE);
}
if let Some(provider) = self.provider.as_deref()
&& ApiProvider::parse(provider).is_none()
&& self
.providers
.as_ref()
.and_then(|providers| providers.custom_provider_config(provider))
.is_none()
{
anyhow::bail!(
"Invalid provider '{provider}': expected {}.",
ApiProvider::names_hint()
);
}
let active_provider = self.api_provider();
match validate_kimi_code_api_model_id(
active_provider,
&self.active_route_base_url(),
&self.default_model(),
) {
Err(error) if error == KIMI_CODE_CLAUDE_ALIAS_GUIDANCE => {
return Err(SafeConfigDiagnostic::KimiCodeClaudeAlias.into());
}
result => result.map_err(anyhow::Error::msg)?,
}
if let Some(ref key) = self.api_key
&& key.trim().is_empty()
{View on GitHub (pinned to 73e0f67d83)