{"record":{"id":"c484a7cc5151b2e3","repo":"zeroclaw-labs/zeroclaw","slug":"model-provider-ref-or-family-does-not-resolve","errorCode":null,"errorMessage":"model_provider `{ref_or_family}` does not resolve to a configured provider","messagePattern":"model_provider `(.+?)` does not resolve to a configured provider","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-channels/src/orchestrator/mod.rs","lineNumber":1588,"sourceCode":"        _ => ModelsCommandResolution::Ambiguous { family, aliases },\n    }\n}\n\nfn resolve_provider_ref_for_runtime_switch(config: &Config, raw: &str) -> anyhow::Result<String> {\n    match resolve_models_command(config, raw) {\n        ModelsCommandResolution::Resolved(provider_ref) => Ok(provider_ref),\n        ModelsCommandResolution::Ambiguous { family, aliases } => {\n            let list = aliases\n                .iter()\n                .map(|alias| format!(\"{family}.{alias}\"))\n                .collect::<Vec<_>>()\n                .join(\", \");\n            anyhow::bail!(\n                \"model_provider `{family}` has multiple configured aliases; use one of: {list}\"\n            )\n        }\n        ModelsCommandResolution::NoAlias(ref_or_family) => {\n            anyhow::bail!(\n                \"model_provider `{ref_or_family}` does not resolve to a configured provider\"\n            )\n        }\n        ModelsCommandResolution::Unknown => {\n            anyhow::bail!(\"unknown model_provider `{raw}`\")\n        }\n    }\n}\n\nfn resolved_runtime_model_provider_ref(\n    config: &Config,\n    agent_alias: &str,\n) -> anyhow::Result<String> {\n    let agent = config\n        .agents\n        .get(agent_alias)\n        .with_context(|| format!(\"agents.{agent_alias} is not configured\"))?;\n    let configured = agent.model_provider.trim();","sourceCodeStart":1570,"sourceCodeEnd":1606,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-channels/src/orchestrator/mod.rs#L1570-L1606","documentation":"Thrown while resolving the argument of a runtime `/models` switch (resolve_provider_ref_for_runtime_switch). `ModelsCommandResolution::NoAlias` means the input named a valid provider family or a dotted `<family>.<alias>` ref, but `config.providers.models.find(...)` found no configured `[providers.models.<family>.<alias>]` entry — either the dotted pair does not exist, or the family exists but has zero configured aliases. The library refuses to construct a provider without a credentialed alias entry, so the model switch is rejected instead of silently using default credentials.","triggerScenarios":"Sending `/models <arg>` over a channel where the arg is either (a) a dotted ref like `openrouter.main` where no `[providers.models.openrouter.main]` section exists, or (b) a bare family name like `openrouter` that `zeroclaw_providers::list_model_providers()` recognizes but for which `aliases_of(&family)` returns an empty list. Also hit by any caller of `resolve_provider_ref_for_runtime_switch` with such an argument.","commonSituations":"User sets `model_provider = \"openai\"` expecting built-in defaults without defining `[providers.models.openai.default]` with an API key; typo in the alias part of a dotted ref (e.g. `openai.defualt`); provider section was renamed or removed from zeroclaw.toml; fresh install where no model provider was ever configured.","solutions":["Check zeroclaw.toml for the `[providers.models.<family>]` table and confirm at least one alias entry exists under it","Add or fix the alias entry, e.g. `zeroclaw config set providers.models.openai.default.api_key sk-...` so `openai` resolves to `openai.default`","If using a dotted ref, verify both segments: family must match a known provider name and alias must match a configured key exactly (case-sensitive lookup)","After editing config, re-run the `/models` command with the family name or the corrected dotted ref"],"exampleFix":"# before (zeroclaw.toml has no model provider section)\n/models openai\n# error: model_provider `openai` does not resolve to a configured provider\n\n# after\nzeroclaw config set providers.models.openai.default.api_key \"sk-...\"\n/models openai   # resolves to openai.default","handlingStrategy":"validation","validationCode":"use zeroclaw_channels::orchestrator::resolve_provider_ref_for_runtime_switch;\n// Before sending the /models switch, dry-run resolution against the same config:\nmatch resolve_provider_ref_for_runtime_switch(&config, arg) {\n    Ok(dotted) => send_models_switch(dotted),\n    Err(e) => notify_user(format!(\"provider switch rejected: {e:#}\")),\n}","typeGuard":null,"tryCatchPattern":"match resolve_provider_ref_for_runtime_switch(&config, raw) {\n    Ok(ref_) => { /* apply switch */ }\n    Err(err) if err.to_string().contains(\"does not resolve to a configured provider\") => {\n        // offer the list of configured [providers.models.<family>.<alias>] pairs\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Keep at least one credentialed alias per provider family you intend to switch to","Prefer fully-qualified dotted refs (`openai.default`) in automation over bare family names","Validate the provider table with a config check command after editing zeroclaw.toml"],"tags":["model-provider","configuration","runtime-switch","zeroclaw"],"backgroundTag":"provider-not-configured","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}