xtekky/gpt4free · critical · RetryProviderError
RetryProvider failed:\n{p}: {type(exception).__name__}: {exc
Error message
RetryProvider failed:\n{p}: {type(exception).__name__}: {exception} What it means
RetryProviderError raised by raise_exceptions when two or more providers in a RetryProvider run each recorded an exception: the messages of every failure are combined ('provider: ExcType: message' per line) and chained from the first exception. It is the aggregated report of a fully failed multi-provider attempt; with exactly one failure, that original exception is re-raised instead.
Source
Thrown at g4f/providers/retry_provider.py:289
else:
async for chunk in super().create_async_generator(
model, messages, **kwargs
):
yield chunk
def raise_exceptions(exceptions: dict) -> None:
"""
Raise a combined exception if any occurred during retries.
Raises:
RetryProviderError: If any provider encountered an exception.
RetryNoProviderError: If no provider is found.
"""
if exceptions:
if len(exceptions) == 1:
raise list(exceptions.values())[0]
raise RetryProviderError(
"RetryProvider failed:\n"
+ "\n".join(
[
f"{p}: {type(exception).__name__}: {exception}"
for p, exception in exceptions.items()
]
)
) from list(exceptions.values())[0]
raise RetryNoProviderError("No content response from any provider. ")
View on GitHub (pinned to 973504e177)
Solutions
- Read each line of the combined message — it enumerates every provider and its root cause; fix the most frequent cause (often blocks or missing auth).
- Update g4f (pip install -U g4f) since mass provider failure usually means upstream sites changed.
- Run from a residential IP / add valid credentials for at least one provider in the chain.
- Narrow the chain to providers you can actually authenticate with, so one success short-circuits the rest.
Example fix
// before
result = await g4f.ChatCompletion.create_async(model, messages) # default retry chain
// after
from g4f.errors import RetryProviderError
try:
result = await g4f.ChatCompletion.create_async(model, messages)
except RetryProviderError as e:
logging.error('all providers failed: %s', e)
result = await my_authed_provider.create_async_generator(model, messages) Defensive patterns
Strategy: fallback
Type guard
def is_retry_provider_error(e: BaseException) -> bool:
from g4f.errors import RetryProviderError
return isinstance(e, RetryProviderError) or str(e).startswith('RetryProvider failed:') Try / catch
from g4f.errors import RetryProviderError
try:
result = await g4f.ChatCompletion.create_async(model, messages)
except RetryProviderError as e:
for line in str(e).splitlines():
logging.warning('provider failure: %s', line)
result = await authed_fallback(model, messages) Prevention
- Configure at least one authenticated provider in the chain so total failure is rare.
- Log each per-provider line of the combined message to identify the dominant cause.
- Update g4f when many providers fail at once — usually an upstream-site change.
When it happens
Trigger: Iterating a RetryProvider (e.g. g4f's default fallback chain) where every provider throws — auth failures, blocks, rate limits — so the exceptions dict has 2+ entries when the generator completes without content.
Common situations: Free-provider outage waves where Cloudflare blocks and 429s hit every mirror simultaneously; expired cookies/credentials across the chain; running from datacenter IPs that most providers block; stale g4f version with broken provider implementations.
Related errors
- config.yaml: No provider succeeded for model {model!r}. Trie
- No providers available
- No content response from any provider.
- Polling images faild. Code: {response.status}
- GLM captcha solving failed after {SOLVE_RETRIES} attempts: {
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/02d1c140b78e7a6c.
Report an issue: GitHub.