zeroclaw-labs/zeroclaw · warning

agent "{name}" uses invalid model_provider "{provider_ref}":

Error message

agent "{name}" uses invalid model_provider "{provider_ref}": {reason}

What it means

check_config_semantics applies the same provider-resolution check to every agent's `model_provider`. Empty refs are skipped; a non-empty ref that fails `create_doctor_model_provider` produces this warning with the underlying reason. Model calls through that agent will fail at request time until the reference is fixed.

Source

Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1368

                cat,
                format!(
                    "channels.discord.{alias}.bot_token is unset but the channel is enabled — the channel cannot connect until a bot token is set"
                ),
            ));
        }
    }

    // Delegate agents: model_provider validity (resolved from model_provider alias)
    let mut agent_names: Vec<_> = config.agents.keys().collect();
    agent_names.sort();
    for name in agent_names {
        let agent = config.agents.get(name).unwrap();
        let provider_ref = agent.model_provider.as_str();
        if provider_ref.is_empty() {
            continue;
        }
        if let Some(reason) = provider_validation_error(config, provider_ref) {
            items.push(DiagItem::warn(
                cat,
                format!(
                    "agent \"{name}\" uses invalid model_provider \"{provider_ref}\": {reason}",
                ),
            ));
        }
    }

    // Non-fatal config warnings — dangling fallback refs, wire_api misuse, etc.
    // Source of truth: `Config::collect_warnings()` (same signal as gateway API
    // and `Config::validate()` tracing). Do not duplicate checks here.
    for warning in config.collect_warnings() {
        items.push(DiagItem::warn(
            cat,
            format!("{} (at {})", warning.message, warning.path),
        ));
    }
}

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Set the agent's `model_provider` to a defined, valid provider key
  2. Re-add or repair the provider slot the agent depends on
  3. Re-run `zeroclaw doctor` until agents report no provider warnings

Example fix

# before
[agents.writer]
model_provider = "gpt4"      # typo, no such provider

# after
[agents.writer]
model_provider = "openai"    # defined under [providers.openai]
Defensive patterns

Strategy: validation

Validate before calling

let out = std::process::Command::new("zeroclaw")
    .args(["doctor"])
    .output()?;
let text = String::from_utf8_lossy(&out.stdout);
if text.contains("uses invalid model_provider") {
    return Err(anyhow::anyhow!("agent model_provider refs are broken; fix before deploy"));
}

Prevention

When it happens

Trigger: An `[agents.<name>]` entry points at a provider name that does not exist in the providers table, or at a slot whose settings are invalid; `zeroclaw doctor` names the agent, the ref, and the reason.

Common situations: Renaming a provider without updating agent definitions; deleting a provider slot an agent still uses; onboarded agents from a template referencing provider keys that were never created.

Related errors


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