xtekky/gpt4free · error · RetryNoProviderError
No providers available
Error message
No providers available
What it means
RetryNoProviderError raised in BaseRetryProvider.create_async_generator when single_provider_retry mode is on and get_providers() returns an empty list — there is no first provider to retry. Unlike the empty-list constructor error (354), the provider set can also be emptied at call time by filtering logic inside get_providers().
Source
Thrown at g4f/providers/retry_provider.py:250
providers (List[Type[BaseProvider]]): List of providers to use.
shuffle (bool): Whether to shuffle the providers list.
single_provider_retry (bool): Whether to retry a single provider if it fails.
max_retries (int): Maximum number of retries for a single provider.
"""
super().__init__(providers, shuffle)
self.single_provider_retry = single_provider_retry
self.max_retries = max_retries
async def create_async_generator(
self, model: str, messages: Messages, **kwargs
) -> AsyncResult:
exceptions = {}
started = False
if self.single_provider_retry:
providers = self.get_providers()
if not providers:
raise RetryNoProviderError("No providers available")
provider = providers[0]
self.last_provider = provider
for attempt in range(self.max_retries):
try:
debug.log(
f"Using {provider.__name__} provider (attempt {attempt + 1})"
)
method = get_async_provider_method(provider)
response = method(model=model, messages=messages, **kwargs)
async for chunk in response:
yield chunk
if is_content(chunk):
started = True
if started:
return
except Exception as e:
exceptions[provider.__name__] = e
if debug.logging:View on GitHub (pinned to 973504e177)
Solutions
- Check what get_providers() returns for your RetryProvider instance before the call, and restore at least one eligible provider.
- Loosen or fix the filter inside get_providers() so eligible providers are not all excluded.
- Construct the retry provider with a known-good list (see error 354) and avoid subclass paths that drop the constructor guard.
- Catch RetryNoProviderError in callers as a configuration signal, not a transient failure — retrying unchanged will not help.
Example fix
// before
chunks = [c async for c in retry_provider.create_async_generator(model, messages)]
// after
providers = retry_provider.get_providers()
if not providers:
raise RuntimeError('retry provider has no eligible providers configured')
chunks = [c async for c in retry_provider.create_async_generator(model, messages)] Defensive patterns
Strategy: validation
Validate before calling
providers = retry_provider.get_providers()
if not providers:
raise RuntimeError('no eligible providers; check filters and provider health') Try / catch
from g4f.errors import RetryNoProviderError
try:
result = await retry_provider.create_async_generator(model, messages)
except RetryNoProviderError as e:
if 'No providers available' in str(e):
logging.error('configuration error: provider list empty at runtime')
raise
raise Prevention
- Audit get_providers()/filter overrides in RetryProvider subclasses.
- Do not retry on this error — it is a configuration defect, not a transient fault.
- Keep a static fallback provider outside the filtered set.
When it happens
Trigger: Calling a RetryProvider subclass with single_provider_retry=True whose provider list became empty after runtime filtering (e.g. all providers marked not working or excluded), so providers[0] would be invalid.
Common situations: Custom get_providers() overrides that filter by health/status flags and filter everything out during an outage; constructing RetryProvider with an empty list bypassing the base check via subclass; providers disabled at runtime by ErrorCounter-driven logic.
Related errors
- RetryProvider failed:\n{p}: {type(exception).__name__}: {exc
- No content response from any provider.
- Polling images faild. Code: {response.status}
- config.yaml: No provider succeeded for model {model!r}. Trie
- RotatedProvider requires a non-empty list of providers.
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/ee0c9beb704f92b7.
Report an issue: GitHub.