{"record":{"id":"6f21724eb0cb7d98","repo":"zeroclaw-labs/zeroclaw","slug":"model-provider-trimmed-does-not-resolve-to-a-c","errorCode":null,"errorMessage":"model_provider `{trimmed}` 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":1629,"sourceCode":"    }\n    let (model_provider, _) = model_provider_entry_for_ref(config, configured)?;\n    Ok(model_provider)\n}\n\nfn model_provider_entry_for_ref<'a>(\n    config: &'a Config,\n    model_provider: &str,\n) -> anyhow::Result<(String, &'a zeroclaw_config::schema::ModelProviderConfig)> {\n    let trimmed = model_provider.trim();\n    if trimmed.is_empty() {\n        anyhow::bail!(\"model_provider reference must not be empty\");\n    }\n\n    let Some((provider_type, provider_alias)) = trimmed.split_once('.') else {\n        anyhow::bail!(\"model_provider `{trimmed}` must use `<type>.<alias>` form\");\n    };\n    let Some(entry) = config.providers.models.find(provider_type, provider_alias) else {\n        anyhow::bail!(\"model_provider `{trimmed}` does not resolve to a configured provider\");\n    };\n    Ok((trimmed.to_string(), entry))\n}\n\n/// Resolve runtime defaults from `config` against a specific dotted\n/// `model_provider` reference (`\"<type>.<alias>\"`) — the per-agent\n/// resolution path.\nfn runtime_defaults_from_config(\n    config: &Config,\n    model_provider: &str,\n) -> anyhow::Result<ChannelRuntimeDefaults> {\n    let (default_model_provider, entry) = model_provider_entry_for_ref(config, model_provider)?;\n    let model = entry\n        .model\n        .as_deref()\n        .map(str::trim)\n        .filter(|model| !model.is_empty())\n        .map(ToString::to_string)","sourceCodeStart":1611,"sourceCodeEnd":1647,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-channels/src/orchestrator/mod.rs#L1611-L1647","documentation":"Thrown by model_provider_entry_for_ref when the reference is correctly dotted as `<type>.<alias>` but `config.providers.models.find(provider_type, provider_alias)` returns None — no `[providers.models.<type>.<alias>]` section matches that exact pair. This is the lookup-miss counterpart to the format error (164): the shape is right, the target does not exist.","triggerScenarios":"Resolving refs like `openai.pro` when only `[providers.models.openai.default]` exists; alias typo (`anthropic.prod` vs configured `anthropic.production`); type segment naming a family with no table in config at all. Any caller of model_provider_entry_for_ref, including the agents runtime reload path, produces it.","commonSituations":"Renaming an alias in zeroclaw.toml without updating agents that reference it; copying an agent stanza between environments whose provider aliases differ; case mismatch — the find is exact, so `OpenAI.default` fails.","solutions":["List configured aliases: inspect `[providers.models.<type>]` tables in zeroclaw.toml and note the exact keys","Fix the reference to an existing pair, e.g. `openai.pro` -> `openai.default`","If the alias should exist, add it: `zeroclaw config set providers.models.<type>.<alias>.api_key <key>`"],"exampleFix":"# before\n[agents.main]\nmodel_provider = \"openai.pro\"   # only openai.default configured\n\n# after\n[agents.main]\nmodel_provider = \"openai.default\"","handlingStrategy":"validation","validationCode":"let (ty, alias) = provider_ref.split_once('.').context(\"expected `<type>.<alias>`\")?;\nif config.providers.models.find(ty, alias).is_none() {\n    anyhow::bail!(\"`{provider_ref}` not in [providers.models]; configured: {:?}\",\n        config.providers.models.aliases_of(ty).collect::<Vec<_>>());\n}","typeGuard":null,"tryCatchPattern":"Err(err) if err.to_string().contains(\"does not resolve to a configured provider\") => {\n    // list available aliases for the family so the operator can correct the ref\n}","preventionTips":["Rename provider aliases with a project-wide grep so agents referencing them are updated together","Validate all agents.*.model_provider refs against [providers.models] in a pre-deploy check","Use exact case for both segments; lookups are not case-insensitive"],"tags":["model-provider","reference-not-found","configuration","zeroclaw"],"backgroundTag":"config-reference-not-found","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}