{"record":{"id":"1f3a60724d0f62f8","repo":"zeroclaw-labs/zeroclaw","slug":"model-provider-model-provider-not-found-in-con","errorCode":null,"errorMessage":"Model provider '{model_provider}' not found in config","messagePattern":"Model provider '(.+?)' not found in config","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/doctor/mod.rs","lineNumber":735,"sourceCode":"        Option<String>,\n        Option<usize>,\n    );\n\n    // Collect all the data we need first to avoid borrow conflicts\n    let targets: Vec<ProviderTarget> = if let Some(model_provider) = provider_override {\n        // Single provider - use find_by_name to look up by \"type.alias\" format\n        if let Some((t, a, entry)) = config.providers.models.find_by_name(model_provider) {\n            vec![(\n                model_provider.to_string(),\n                t.to_string(),\n                a.to_string(),\n                entry.model.clone().unwrap_or_default(),\n                entry.uri.clone(),\n                entry.api_key.clone(),\n                entry.context_window,\n            )]\n        } else {\n            anyhow::bail!(\"Model provider '{model_provider}' not found in config\");\n        }\n    } else {\n        // All providers\n        config\n            .providers\n            .models\n            .iter_entries()\n            .map(|(t, a, e)| {\n                (\n                    format!(\"{t}.{a}\"),\n                    t.to_string(),\n                    a.to_string(),\n                    e.model.clone().unwrap_or_default(),\n                    e.uri.clone(),\n                    e.api_key.clone(),\n                    e.context_window,\n                )\n            })","sourceCodeStart":717,"sourceCodeEnd":753,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/doctor/mod.rs#L717-L753","documentation":"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.","triggerScenarios":"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.","commonSituations":"Automation scripts hardcoding provider aliases across config renames; confusion between the provider alias key and the model field inside it.","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"],"exampleFix":"# before — a model name is not a provider alias\nzeroclaw doctor models --provider gpt-4o\n\n# after — use the alias key from zeroclaw.toml\nzeroclaw doctor models --provider openai","handlingStrategy":"validation","validationCode":"if !config.providers.models.contains_key(model_provider) {\n    let known: Vec<_> = config.providers.models.keys().collect();\n    anyhow::bail!(\"provider '{model_provider}' not in config; known aliases: {known:?}\");\n}","typeGuard":"fn is_configured_provider_alias(config: &zeroclaw_config::schema::Config, alias: &str) -> bool {\n    config.providers.models.contains_key(alias)\n}","tryCatchPattern":"if let Err(err) = update_context_windows(&config, Some(&alias)) {\n    if err.to_string().contains(\"not found in config\") {\n        eprintln!(\"'{alias}' is not a model_providers key — pass the alias, not a model name\");\n    }\n    return Err(err);\n}","preventionTips":["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"],"tags":["doctor","model-providers","config-reference"],"backgroundTag":"unresolved-config-reference","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}