xtekky/gpt4free · critical · RuntimeError

config.yaml: No provider succeeded for model {model!r}. Trie

Error message

config.yaml: No provider succeeded for model {model!r}. Tried: {tried}

What it means

RuntimeError raised at the end of config_provider's generator chain: every provider listed in config.yaml for the requested model was attempted and all raised (or none were eligible), with no last_exception retained the loop falls through to this summary error naming the model and the tried provider list. When a concrete exception exists it is re-raised instead, so this message means total failure with nothing better to surface.

Source

Thrown at g4f/providers/config_provider.py:600

                return  # Success
            except Exception as e:
                # On rate-limit errors invalidate the quota cache
                from ..errors import RateLimitError

                if isinstance(e, RateLimitError) or "429" in str(e):
                    debug.log(
                        f"config.yaml: Rate-limited by {provider_name}, "
                        "invalidating quota cache"
                    )
                    QuotaCache.invalidate(provider_name)

                ErrorCounter.increment(provider_name)
                last_exception = e
                debug.error(f"config.yaml: {provider_name} failed:", e)

        if last_exception is not None:
            raise last_exception
        raise RuntimeError(
            f"config.yaml: No provider succeeded for model {model!r}. "
            f"Tried: {tried}"
        )

View on GitHub (pinned to 973504e177)

Solutions

  1. Enable debug logging (g4f.debug.logging = True) and read the per-provider 'config.yaml: <provider> failed:' lines to see each root cause.
  2. Fix the most common single cause first (usually missing auth or one bad model mapping) — often one fix revives several providers.
  3. Add more providers to config.yaml for the model, or verify the model is offered by at least one entry.
  4. If all providers are rate-limited (see QuotaCache invalidation logs), wait and retry later.

Example fix

# before (config.yaml)
model: gpt-4o
providers:
  - provider: "ProviderA"   # every entry failing

# after
model: gpt-4o
providers:
  - provider: "ProviderA"
  - provider: "OpenaiChat"  # fallback that works
Defensive patterns

Strategy: fallback

Try / catch

try:
    result = await config_chain(model, messages)
except RuntimeError as e:
    if 'No provider succeeded' in str(e):
        logging.error('config chain exhausted: %s', e)
        result = await manual_fallback(model, messages)  # known-good authed provider
    else:
        raise

Prevention

When it happens

Trigger: Calling the config-based provider chain for a model where every configured provider fails (auth errors, network, model not offered) — each failure is logged, counted in ErrorCounter, and after the loop the RuntimeError with the tried list is raised.

Common situations: All configured providers lack credentials on a fresh machine; the model name in the request matches config.yaml but no provider actually serves it; an upstream outage taking down every free provider at once.

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/5c9a2491ccf95f13. Report an issue: GitHub.