Hmbown/CodeWhale · error

ProviderKind variant missing from PROVIDER_REGISTRY

Error message

ProviderKind variant missing from PROVIDER_REGISTRY

What it means

provider_for_kind() looks up a ProviderKind in the static PROVIDER_REGISTRY and unwraps, since every ProviderKind variant is required to have a registered provider descriptor. The panic fires only when a new ProviderKind variant is added without a matching registry entry — a build-time omission.

Source

Thrown at crates/config/src/provider.rs:1804

        .iter()
        .copied()
        .find(|provider| provider.id() == id)
}

/// Resolve a provider by canonical id or supported legacy alias.
#[must_use]
pub fn resolve_provider(id_or_alias: &str) -> Option<&'static dyn Provider> {
    ProviderKind::parse(id_or_alias).map(provider_for_kind)
}

/// Return metadata for a known provider kind.
#[must_use]
pub fn provider_for_kind(kind: ProviderKind) -> &'static dyn Provider {
    PROVIDER_REGISTRY
        .iter()
        .find(|p| p.kind() == kind)
        .copied()
        .expect("ProviderKind variant missing from PROVIDER_REGISTRY")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn credential_help_covers_every_provider_without_guessing_non_key_urls() {
        for provider in all_providers() {
            let help = provider.credential_help();
            assert!(
                !help.guidance.trim().is_empty(),
                "{} credential guidance must not be empty",
                provider.id()
            );

            match help.acquisition {
                CredentialAcquisition::ApiKey | CredentialAcquisition::ApiKeyOrOAuth => {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Register the new ProviderKind variant in PROVIDER_REGISTRY
  2. Add a test asserting every ProviderKind variant resolves through the registry
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at crates/config/src/provider.rs:1804 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/76b1437049ab6228. Report an issue: GitHub.