aaif-goose/goose · error

Provider not found: {}

Error message

Provider not found: {}

What it means

Provider lookup for declarative providers checks, in order, the JSON files in the custom_providers directory and the fixed built-in declarative provider configs (matched by name). If neither contains the requested id, this error is returned with the id that failed.

Source

Thrown at crates/goose/src/config/declarative_providers.rs:348

        let content = std::fs::read_to_string(&custom_file_path)?;
        let config = deserialize_provider_config(&content)?;
        return Ok(LoadedProvider {
            config,
            is_editable: true,
        });
    }

    if let Some(config) = fixed_provider_configs()?
        .into_iter()
        .find(|config| config.name == id)
    {
        return Ok(LoadedProvider {
            config,
            is_editable: false,
        });
    }

    Err(anyhow::anyhow!("Provider not found: {}", id))
}

pub fn register_declarative_providers(
    registry: &mut crate::providers::provider_registry::ProviderRegistry,
) -> Result<()> {
    let dir = custom_providers_dir();
    let custom_providers = load_custom_providers(&dir)?;
    let fixed_providers = fixed_provider_configs()?;
    for config in fixed_providers {
        register_declarative_provider(registry, config, ProviderType::Declarative);
    }

    for config in custom_providers {
        register_declarative_provider(registry, config, ProviderType::Custom);
    }

    Ok(())
}

View on GitHub (pinned to 3810898a74)

Solutions

  1. List the actual ids: fixed ids come from the built-in declarative configs, custom ids are the file stems in the custom_providers dir (dir from custom_providers_dir())
  2. Remove any `.json` suffix and correct casing — lookup is exact string equality on config.name
  3. Re-create the missing custom provider if its JSON file was deleted

Example fix

// before
let provider = get_declarative_provider("acme.json")?;

// after
let provider = get_declarative_provider("acme")?;
Defensive patterns

Strategy: validation

Validate before calling

use goose::config::declarative_providers::custom_providers_dir;

fn provider_id_exists(id: &str) -> bool {
    custom_providers_dir().join(format!("{}.json", id)).exists()
    // fixed providers are matched by config.name; check the built-in list too
}

Try / catch

match get_declarative_provider(id) {
    Err(e) if e.to_string().starts_with("Provider not found") => {
        // list available ids and surface a chooser to the user
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling get_declarative_provider("acme") when no acme.json exists in the custom_providers dir and no fixed provider is named acme; ids passed with a `.json` suffix, wrong casing, or trailing whitespace; the custom provider file was deleted or renamed.

Common situations: Typo in a `--provider` flag or config value; referencing a provider on a machine where it was never created; stale references after renaming a custom provider; appending `.json` because that is the filename.

Related errors


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