huggingface/open-r1 · error

Unknown provider type: {provider_type}

Error message

Unknown provider type: {provider_type}

What it means

get_provider is a factory that dispatches on provider_type and raises ValueError for any value it doesn't recognize. Only the explicitly handled provider types (e2b, morph, etc.) are supported; unknown strings fall through to the final else. This is a fail-fast guard against typos and unsupported providers in reward config.

Source

Thrown at src/open_r1/utils/code_providers.py:366

    """
    num_parallel = kwargs.pop("num_parallel", 2)

    if provider_type == "e2b":
        # Extract E2B-specific arguments
        e2b_router_url = kwargs.pop("e2b_router_url", None)
        return E2BProvider(
            num_parallel=num_parallel,
            e2b_router_url=e2b_router_url,
        )
    elif provider_type == "morph":
        # Extract Morph-specific arguments
        morph_router_url = kwargs.pop("morph_router_url", None)
        return MorphProvider(
            num_parallel=num_parallel,
            morph_router_url=morph_router_url,
        )
    else:
        raise ValueError(f"Unknown provider type: {provider_type}")

View on GitHub (pinned to 1416fa0cf2)

Solutions

  1. Check the provider_type string against the supported values in get_provider's source
  2. Fix casing/typos (values are matched exactly, e.g. "e2b" not "E2B")
  3. Use a provider implemented in this version of the library
  4. If a new provider is needed, add a branch to get_provider or pass kwargs through an already-supported provider

Example fix

// before
provider = get_provider("E2B", num_parallel=4)  # ValueError: Unknown provider type: E2B
// after
provider = get_provider("e2b", num_parallel=4)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_PROVIDERS = {"e2b", "morph"}  # per get_provider's branches

def pick_provider(provider_type: str, **kwargs):
    if provider_type not in SUPPORTED_PROVIDERS:
        raise SystemExit(f"provider_type must be one of {sorted(SUPPORTED_PROVIDERS)}, got {provider_type!r}")
    return get_provider(provider_type, **kwargs)

Type guard

def is_known_provider(provider_type) -> bool:
    return isinstance(provider_type, str) and provider_type in {"e2b", "morph"}

Try / catch

try:
    provider = get_provider(provider_type, **kwargs)
except ValueError as e:
    if str(e).startswith("Unknown provider type"):
        logger.error("%s — check the code_provider field in your config (case-sensitive)", e)
        raise SystemExit(1) from e
    raise

Prevention

When it happens

Trigger: Calling get_provider(...) (e.g. from the code_reward pipeline via kwargs) with a provider_type value not handled by the factory's if/elif chain — misspellings like "E2B", "e2b_code", "modal" (if unimplemented), or an empty/None string.

Common situations: Typo in a training config's code_provider field; YAML/CLI value passed with wrong casing; copying a config from a fork that supports extra providers this version doesn't; passing a provider object where a string was expected.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of huggingface/open-r1@1416fa0cf2 (2026-08-30). Data as JSON: /api/errors/6e87c35614f6af72. Report an issue: GitHub.