zeroclaw-labs/zeroclaw · error · anyhow::Error
Model provider '{model_provider}' not found in config
Error message
Model provider '{model_provider}' not found in config What it means
update_context_windows refreshes per-provider context-window metadata; with a provider override it looks the alias up in config.providers.models and bails when the key is absent. The override must be an exact alias key from the model_providers table, not a model name or a URI fragment.
Source
Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:735
Option<String>,
Option<usize>,
);
// Collect all the data we need first to avoid borrow conflicts
let targets: Vec<ProviderTarget> = if let Some(model_provider) = provider_override {
// Single provider - use find_by_name to look up by "type.alias" format
if let Some((t, a, entry)) = config.providers.models.find_by_name(model_provider) {
vec![(
model_provider.to_string(),
t.to_string(),
a.to_string(),
entry.model.clone().unwrap_or_default(),
entry.uri.clone(),
entry.api_key.clone(),
entry.context_window,
)]
} else {
anyhow::bail!("Model provider '{model_provider}' not found in config");
}
} else {
// All providers
config
.providers
.models
.iter_entries()
.map(|(t, a, e)| {
(
format!("{t}.{a}"),
t.to_string(),
a.to_string(),
e.model.clone().unwrap_or_default(),
e.uri.clone(),
e.api_key.clone(),
e.context_window,
)
})View on GitHub (pinned to 88bb9c8533)
Solutions
- List the alias keys under [model_providers.*] in zeroclaw.toml and pass the exact key
- Or drop the override to update context windows for all configured providers
Example fix
# before — a model name is not a provider alias zeroclaw doctor models --provider gpt-4o # after — use the alias key from zeroclaw.toml zeroclaw doctor models --provider openai
Defensive patterns
Strategy: validation
Validate before calling
if !config.providers.models.contains_key(model_provider) {
let known: Vec<_> = config.providers.models.keys().collect();
anyhow::bail!("provider '{model_provider}' not in config; known aliases: {known:?}");
} Type guard
fn is_configured_provider_alias(config: &zeroclaw_config::schema::Config, alias: &str) -> bool {
config.providers.models.contains_key(alias)
} Try / catch
if let Err(err) = update_context_windows(&config, Some(&alias)) {
if err.to_string().contains("not found in config") {
eprintln!("'{alias}' is not a model_providers key — pass the alias, not a model name");
}
return Err(err);
} Prevention
- Derive provider aliases from config at runtime instead of hardcoding them in scripts
- Remember the override takes the table key under [model_providers.*], never the model field or URI
When it happens
Trigger: Passing a provider override with a typo'd alias; passing a model id (for example "gpt-4o") or a URI where the alias is expected; the provider was renamed in config while scripts still use the old alias.
Common situations: Automation scripts hardcoding provider aliases across config renames; confusion between the provider alias key and the model field inside it.
Related errors
- No configured model_providers to probe — run `zeroclaw quick
- Model probe failed for target model_provider
- No configured model_providers — run `zeroclaw quickstart` to
- No configured model verified for target model_provider
- [heartbeat] agent = {agent_alias:?} is not configured ([agen
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/1f3a60724d0f62f8.
Report an issue: GitHub.