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

  1. Enable litellm.set_verbose = True and rerun to see each individual fallback failure in logs.
  2. 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).
  3. Diversify fallbacks across providers/keys/regions so one failure mode can't take down the whole chain.
  4. 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

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


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)