BerriAI/litellm · critical · Exception
. All fallback attempts failed. Enable verbose logging with…
Error message
{most_recent_exception_str}. All fallback attempts failed. Enable verbose logging with `litellm.set_verbose=True` for details. What it means
In fallback_utils, the fallback loop tries each configured fallback model; every attempt's exception is caught, its string saved as most_recent_exception_str, and the loop continues. If ALL attempts fail, litellm raises a plain Exception: '<last error>. All fallback attempts failed. Enable verbose logging with `litellm.set_verbose=True` for details.' Note it is a builtin Exception, not a litellm error subclass, and only the LAST error's string survives.
Solutions
- Enable litellm.set_verbose = True and rerun to see each individual fallback failure in logs.
- Fix the error shown in the message first — it's the last fallback's cause and usually the same for all (auth, rate limit, connectivity).
- Diversify fallbacks across providers/keys/regions so one failure mode can't take down the whole chain.
- Catch the raised Exception explicitly (it's not a litellm.Timeout/APIError subclass) and alert on it — total fallback exhaustion is an operational event.
Example fix
# before
response = completion_with_fallbacks(model=gpt4, fallbacks=["gpt-3.5-turbo"], **kwargs)
# after
import litellm
litellm.set_verbose = True # log per-fallback failures
try:
response = completion_with_fallbacks(model=gpt4, fallbacks=["claude-3-5-sonnet", "gpt-4o-mini"], **kwargs)
except Exception as e: # plain Exception, not a litellm subclass
alert("all fallbacks exhausted", last_error=str(e))
raise Defensive patterns
Strategy: fallback
Validate before calling
# before running the chain: sanity-check every model in it
import litellm
for m in [primary, *fallbacks]:
assert isinstance(m, str) and m, f"bad model entry: {m!r}"
assert provider_creds_present(m), f"no credentials configured for {m}" Try / catch
try:
response = completion_with_fallbacks(model=primary, fallbacks=fbs, **kwargs)
except Exception as e: # NOTE: plain Exception, not a litellm error subclass
if "All fallback attempts failed" in str(e):
page_oncall("entire fallback chain down", last_error=str(e))
raise Prevention
- Run litellm.set_verbose = True in lower environments so per-fallback failures are visible.
- Diversify fallbacks across providers AND credentials so one failure mode can't kill the chain.
- Catch builtin Exception for this path — litellm-specific except clauses will miss it.
- Alert on fallback exhaustion as a critical event; the message only carries the last error.
When it happens
Trigger: Every model in a fallback chain failing: primary + all fallbacks have bad credentials (401), are rate-limited (429), unreachable (DNS/proxy), or their model slugs are invalid (404). The message shows only the final fallback's error; earlier ones appear only in verbose logs.
Common situations: Shared bad API key across all fallback deployments; exhausting rate limits on every provider simultaneously during traffic spikes; fallback lists pointing at deleted/renamed models; network egress blocked to all provider domains; router configs copying the same wrong env var into every entry.
Related errors
- LLM router not found. Please set it up by passing in a…
- LLM Router not initialized. Ensure models added to proxy.
- Unable to parse model, max fallback depth exceeded -…
- 400
- 404
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/278719aba3bc0ab2.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/fallback_utils.py:79
response = await litellm.acompletion(
**completion_kwargs,
model=model,
litellm_logging_obj=litellm_logging_obj,
)
if response is not None:
return add_fallback_headers_to_response(
response=response,
attempted_fallbacks=attempted_fallbacks,
)
except Exception as e:
verbose_logger.exception("Fallback attempt failed for model %s: %s", model, e)
most_recent_exception_str = str(e)
continue
raise Exception(
f"{most_recent_exception_str}. All fallback attempts failed. Enable verbose logging with `litellm.set_verbose=True` for details."
)
def completion_with_fallbacks(**kwargs):
return run_async_function(async_function=async_completion_with_fallbacks, **kwargs)
View on GitHub (pinned to 77b7c6c40c)