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

agents.{agent_alias}.model_provider is empty — set it to a c

Error message

agents.{agent_alias}.model_provider is empty — set it to a configured "<type>.<alias>" (e.g. "anthropic.{agent_alias}")

What it means

The V3 schema requires every agent to declare model_provider explicitly; when the field is an empty string, agent construction fails with this error instead of silently picking a default. The message suggests the conventional form "anthropic.<agent_alias>" as a starting point.

Source

Thrown at crates/zeroclaw-runtime/src/agent/agent.rs:1573

                policy.allowed_roots.push(agent_workspace.clone());
            }
            policy
        });

        let (provider_name, provider_alias, agent_model_provider) =
            match config.resolved_model_provider_for_agent(agent_alias) {
                Some(resolved) => (resolved.0, resolved.1, Some(resolved.2)),
                None => {
                    let agent_ref = agent_cfg.model_provider.as_str();
                    if !agent_ref.is_empty() {
                        anyhow::bail!(
                            "agents.{agent_alias}.model_provider = \"{agent_ref}\" does not \
                             resolve to a configured [providers.models.<type>.<alias>] entry"
                        );
                    }
                    // V3 schema requires every agent to set model_provider.
                    // Empty is a config error rather than a silent fallback.
                    anyhow::bail!(
                        "agents.{agent_alias}.model_provider is empty — set it to a \
                         configured \"<type>.<alias>\" (e.g. \"anthropic.{agent_alias}\")"
                    );
                }
            };
        let memory: Arc<dyn Memory> = zeroclaw_memory::create_memory_for_agent(
            config,
            agent_alias,
            agent_model_provider.and_then(|e| e.api_key.as_deref()),
        )
        .await?;

        let composio_key = if config.composio.enabled {
            config.composio.api_key.as_deref()
        } else {
            None
        };
        let composio_entity_id = if config.composio.enabled {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Set agents.<alias>.model_provider to a configured "<type>.<alias>" such as "anthropic.default".
  2. Ensure the referenced [providers.models.<type>.<alias>] table exists and sets a model.
  3. Add a config lint step that rejects empty model_provider values before deploy.

Example fix

# before
[agents.helper]
model_provider = ""

# after
[agents.helper]
model_provider = "anthropic.default"
Defensive patterns

Strategy: validation

Validate before calling

// Startup lint: no empty model_provider
for (alias, agent) in &config.agents {
    anyhow::ensure!(
        !agent.model_provider.as_str().trim().is_empty(),
        "agents.{alias}.model_provider is empty"
    );
}

Prevention

When it happens

Trigger: agents.<alias>.model_provider = "" in the TOML; a new agent table added without the model_provider key resolving to empty; a template with an unfilled placeholder.

Common situations: Hand-adding an agent block and forgetting the provider line; provisioning scripts emitting empty fields; migrating configs where the field used to be optional.

Related errors


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