High severity intermediate · Fix: 5-10 min

LiteLLMFallbackError

litellm.errors.LiteLLMFallbackError

What this error means
LiteLLM failed to load a fallback model because all configured providers were unavailable or returned errors.

Stack trace

traceback
Traceback (most recent call last):
  File "app.py", line 42, in <module>
    response = litellm_client.generate(prompt)
  File "/usr/local/lib/python3.9/site-packages/litellm/client.py", line 128, in generate
    raise LiteLLMFallbackError("Fallback model failed all providers")
litellm.errors.LiteLLMFallbackError: Fallback model failed all providers
QUICK FIX
Verify and set valid API keys for all fallback providers in environment variables to restore fallback model availability immediately.

Why it happens

LiteLLM attempts to use a fallback model when the primary model or provider fails. This error occurs when all fallback providers are either unreachable, misconfigured, or return errors, leaving no available model to serve the request.

Detection

Monitor LiteLLM client calls for LiteLLMFallbackError exceptions and log provider statuses to detect when fallback models fail before the application crashes.

Causes & fixes

1

All fallback providers are misconfigured or missing API keys.

✓ Fix

Ensure all fallback providers have valid API keys set in environment variables and are correctly configured in LiteLLM.

2

Network connectivity issues prevent contacting fallback providers.

✓ Fix

Check network access and firewall rules to allow outbound connections to all fallback provider endpoints.

3

Fallback providers are rate limited or temporarily down.

✓ Fix

Implement retry logic with exponential backoff and monitor provider status pages to handle temporary outages.

4

Fallback model names or versions are incorrect or deprecated.

✓ Fix

Verify fallback model identifiers against provider documentation and update to supported versions.

Code: broken vs fixed

Broken - triggers the error
python
import os
from litellm import LiteLLMClient

client = LiteLLMClient()
response = client.generate("Hello world")  # Raises LiteLLMFallbackError here
print(response)
Fixed - works correctly
python
import os
from litellm import LiteLLMClient

os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "your_openai_api_key")
os.environ["ANOTHER_PROVIDER_API_KEY"] = os.environ.get("ANOTHER_PROVIDER_API_KEY", "your_other_provider_key")

client = LiteLLMClient()
response = client.generate("Hello world")  # Fixed: fallback providers configured
print(response)
Added required API keys in environment variables so LiteLLM can access fallback providers, preventing fallback failure.

Workaround

Catch LiteLLMFallbackError in your code and provide a static canned response or degrade gracefully while investigating provider issues.

Prevention

Configure multiple fallback providers with valid credentials and implement health checks and retries to ensure fallback availability under all conditions.

Python 3.9+ · litellm >=0.1.0 · tested on 0.2.5
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.