aaif-goose/goose · error

Provider '{}' has dynamic_models: false but no static models

Error message

Provider '{}' has dynamic_models: false but no static models listed; at least one entry in `models` is required.

What it means

When building the Anthropic provider from a custom provider config, goose resolves the model list: if dynamic_models is explicitly false, the static models array is the only source of models. This error means the config declared dynamic_models: false but listed no models entries, leaving the provider with no way to serve or list any model.

Source

Thrown at crates/goose-providers/src/anthropic.rs:400

pub fn from_declarative_config(
    config: DeclarativeProviderConfig,
    tls_config: Option<TlsConfig>,
    key_resolver: impl KeyResolver,
) -> Result<AnthropicProviderBuilder> {
    let custom_models = if !config.models.is_empty() {
        Some(
            config
                .models
                .iter()
                .map(|m| m.name.clone())
                .collect::<Vec<String>>(),
        )
    } else {
        None
    };

    if config.dynamic_models == Some(false) && custom_models.is_none() {
        return Err(anyhow::anyhow!(
            "Provider '{}' has dynamic_models: false but no static models listed; \
             at least one entry in `models` is required.",
            config.name
        ));
    }

    let api_key = if config.api_key_env.is_empty() {
        None
    } else {
        match key_resolver.resolve_key(config.api_key_env.as_str()) {
            Ok(key) => Some(key),
            Err(err) => {
                if config.requires_auth {
                    anyhow::bail!("missing required key {}: {}", config.api_key_env, err);
                }
                None
            }
        }

View on GitHub (pinned to 3810898a74)

Solutions

  1. Add at least one entry under models in the provider config, e.g. models: [{name: claude-sonnet-4-5}]
  2. Or allow dynamic model fetching: set dynamic_models: true (or remove the key to use the default)
  3. Re-run goose configure to validate the provider loads without the error

Example fix

# before
name: my-anthropic
type: anthropic
dynamic_models: false

# after
name: my-anthropic
type: anthropic
dynamic_models: false
models:
  - name: claude-sonnet-4-5
  - name: claude-opus-4-1
Defensive patterns

Strategy: validation

Validate before calling

fn anthropic_config_is_loadable(cfg: &ProviderConfig) -> bool {
    cfg.dynamic_models != Some(false) || !cfg.models.is_empty()
}

if !anthropic_config_is_loadable(&cfg) {
    anyhow::bail!("fix config before starting: add models or enable dynamic_models");
}

Prevention

When it happens

Trigger: A providers.yaml/config entry of type anthropic with dynamic_models: false and either no models key or an empty models list. Raised at provider construction time (goose configure / startup), before any request is made.

Common situations: Users pinning static model lists for air-gapped or proxied Anthropic deployments but forgetting the models block; copying a template that had dynamic_models: false with the models stripped; setting dynamic_models: false intentionally to stop remote model fetching while expecting built-in defaults (there are none for custom providers).

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/0cc9c4f86971e569. Report an issue: GitHub.