NanmiCoder/MediaCrawler · error · ValueError

Unknown proxy provider: '{config.IP_PROXY_PROVIDER_NAME}'. V

Error message

Unknown proxy provider: '{config.IP_PROXY_PROVIDER_NAME}'. Valid options: {list(IpProxyProvider.keys())}

What it means

Raised by create_ip_pool() when config.IP_PROXY_PROVIDER_NAME is not a key in the IpProxyProvider registry dict. This is a configuration error at startup: the configured proxy provider name does not match any registered provider factory. The message lists all valid keys.

Source

Thrown at proxy/proxy_ip_pool.py:207


IpProxyProvider: Dict[str, ProxyProvider] = {
    ProviderNameEnum.KUAI_DAILI_PROVIDER.value: new_kuai_daili_proxy(),
    ProviderNameEnum.WANDOU_HTTP_PROVIDER.value: new_wandou_http_proxy(),
    ProviderNameEnum.STATIC_PROVIDER.value: StaticProxyProvider(),
}


async def create_ip_pool(ip_pool_count: int, enable_validate_ip: bool) -> ProxyIpPool:
    """
    Create IP proxy pool
    :param ip_pool_count: Number of IPs in the pool
    :param enable_validate_ip: Whether to enable IP proxy validation
    :return:
    """
    ip_provider = IpProxyProvider.get(config.IP_PROXY_PROVIDER_NAME)
    if ip_provider is None:
        raise ValueError(
            f"Unknown proxy provider: '{config.IP_PROXY_PROVIDER_NAME}'. "
            f"Valid options: {list(IpProxyProvider.keys())}"
        )
    is_static = config.IP_PROXY_PROVIDER_NAME == ProviderNameEnum.STATIC_PROVIDER.value
    pool = ProxyIpPool(
        ip_pool_count=ip_pool_count,
        enable_validate_ip=False if is_static else enable_validate_ip,
        ip_provider=ip_provider,
    )
    await pool.load_proxies()
    return pool


if __name__ == "__main__":
    pass

View on GitHub (pinned to d6f7c5bb90)

Solutions

  1. Check the error message — it prints the exact list of valid names, e.g. ['kuaidaili', 'wandou', 'static']
  2. Set IP_PROXY_PROVIDER_NAME in config/base_config.py (or env) to one of those exact, case-sensitive strings
  3. To run without a paid proxy provider, use the static/no-proxy provider entry
  4. After renaming, restart the process — the check runs once at pool creation

Example fix

// before
IP_PROXY_PROVIDER_NAME = "kdl"

// after
IP_PROXY_PROVIDER_NAME = "kuaidaili"  # must match a key in IpProxyProvider
Defensive patterns

Strategy: validation

Validate before calling

from proxy.proxy_ip_pool import IpProxyProvider

assert config.IP_PROXY_PROVIDER_NAME in IpProxyProvider, (
    f"IP_PROXY_PROVIDER_NAME must be one of {list(IpProxyProvider)}"
)
pool = await create_ip_pool(...)

Type guard

def is_known_provider(name: str) -> bool:
    return isinstance(name, str) and name in IpProxyProvider

Try / catch

try:
    pool = await create_ip_pool(n, True)
except ValueError as e:
    # message already lists valid options; surface it to the user
    raise SystemExit(f"config error: {e}") from e

Prevention

When it happens

Trigger: Setting IP_PROXY_PROVIDER_NAME to an unregistered value (typo, wrong case, or a provider whose dependencies aren't installed), or leaving it set to a name that only exists in a different fork/version of the project.

Common situations: Typos like 'kdl' vs 'kuaidaili' or 'wandouproxy' vs 'wandou'; upgrading MediaCrawler versions where provider names were renamed; copying a config from a fork with extra providers.

Related errors


AI-assisted analysis of NanmiCoder/MediaCrawler@d6f7c5bb90 (2026-08-15). Data as JSON: /api/errors/e9e816ba83e71340. Report an issue: GitHub.