zeroclaw-labs/zeroclaw · error · anyhow::Error

unknown model_provider `{raw}`

Error message

unknown model_provider `{raw}`

What it means

Thrown while resolving a `/models` runtime switch argument (resolve_provider_ref_for_runtime_switch). `ModelsCommandResolution::Unknown` means `canonical_model_provider_name()` found no match (case-insensitive) for the trimmed argument in `zeroclaw_providers::list_model_providers()` — the argument does not name any provider family the binary knows about, and it was not a dotted ref that resolved. It is the strictest of the resolution failures: the name itself is unrecognized.

Source

Thrown at crates/zeroclaw-channels/src/orchestrator/mod.rs:1593

    match resolve_models_command(config, raw) {
        ModelsCommandResolution::Resolved(provider_ref) => Ok(provider_ref),
        ModelsCommandResolution::Ambiguous { family, aliases } => {
            let list = aliases
                .iter()
                .map(|alias| format!("{family}.{alias}"))
                .collect::<Vec<_>>()
                .join(", ");
            anyhow::bail!(
                "model_provider `{family}` has multiple configured aliases; use one of: {list}"
            )
        }
        ModelsCommandResolution::NoAlias(ref_or_family) => {
            anyhow::bail!(
                "model_provider `{ref_or_family}` does not resolve to a configured provider"
            )
        }
        ModelsCommandResolution::Unknown => {
            anyhow::bail!("unknown model_provider `{raw}`")
        }
    }
}

fn resolved_runtime_model_provider_ref(
    config: &Config,
    agent_alias: &str,
) -> anyhow::Result<String> {
    let agent = config
        .agents
        .get(agent_alias)
        .with_context(|| format!("agents.{agent_alias} is not configured"))?;
    let configured = agent.model_provider.trim();
    if configured.is_empty() {
        anyhow::bail!(
            "agents.{agent_alias}.model_provider is empty; runtime reload requires a dotted `<type>.<alias>` provider reference"
        );
    }

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. List the provider families the binary supports by checking `zeroclaw_providers::list_model_providers()` output (e.g. `zeroclaw models list` or the providers docs) and use one of those names
  2. Fix typos and remember family matching is against provider names, not model names
  3. If you meant a specific model, first switch to the family (`/models openai`) and set the model through that provider's own configuration

Example fix

# before
/models gpt-4o   # model name, not a provider
# error: unknown model_provider `gpt-4o`

# after
/models openai   # family name from list_model_providers()
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the family check before issuing /models:
fn is_known_family(name: &str) -> bool {
    zeroclaw_providers::list_model_providers()
        .iter()
        .any(|p| p.name.eq_ignore_ascii_case(name.trim()))
}
if !is_known_family(arg) && !arg.contains('.') {
    notify_user("unknown provider family; run `zeroclaw models list`");
}

Try / catch

Err(err) if err.to_string().starts_with("unknown model_provider") => {
    // surface the known family list to the chat user
}

Prevention

When it happens

Trigger: Sending `/models <name>` where `<name>` is not any known provider family, e.g. `/models gpt4`, `/models my-custom-llm`, or a misspelled family like `/models openaai`. Dotted refs whose family segment is unknown also land here only when the whole string fails the family match; otherwise NoAlias (error 160) applies.

Common situations: User passes a model name instead of a provider name (`/models claude-3` instead of `/models anthropic`); typo in the provider family; expecting a custom provider registered in code to appear in the built-in list; stale docs naming a provider that the current binary version does not ship.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/6395c9e4f49e1124. Report an issue: GitHub.