BerriAI/litellm · error · NotFoundError

{exception_provider} - {message}

Error message

{exception_provider} - {message}

What it means

Exception-mapping branch: for provider errors that match no specific class (status 400/422-style bad requests and other generic cases), the original exception is re-raised as a litellm exception with the provider-prefixed message, preserving provider details while normalizing type.

Solutions

  1. Inspect the provider message for the underlying cause and fix the request accordingly.
  2. Enable verbose logging (litellm.set_verbose=True) to see the full provider response.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:306 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/4e28009383242f27. Report an issue: GitHub.

Appendix: source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:306

    if ExceptionCheckers.is_error_str_rate_limit(
        error_str, status_code=getattr(original_exception, "status_code", None)
    ):
        raise RateLimitError(
            message=f"RateLimitError: {exception_provider} - {message}",
            model=model,
            llm_provider=custom_llm_provider,
            response=getattr(original_exception, "response", None),
        )
    elif ExceptionCheckers.is_error_str_context_window_exceeded(error_str):
        raise ContextWindowExceededError(
            message=f"ContextWindowExceededError: {exception_provider} - {message}",
            llm_provider=custom_llm_provider,
            model=model,
            response=getattr(original_exception, "response", None),
            litellm_debug_info=extra_information,
        )
    elif "invalid_request_error" in error_str and "model_not_found" in error_str:
        raise NotFoundError(
            message=f"{exception_provider} - {message}",
            llm_provider=custom_llm_provider,
            model=model,
            response=getattr(original_exception, "response", None),
            litellm_debug_info=extra_information,
        )
    elif "A timeout occurred" in error_str:
        raise Timeout(
            message=f"{exception_provider} - {message}",
            model=model,
            llm_provider=custom_llm_provider,
            litellm_debug_info=extra_information,
        )
    elif (
        ("invalid_request_error" in error_str and "content_policy_violation" in error_str)
        or ("Invalid prompt" in error_str and "violating our usage policy" in error_str)
        or ("request was rejected as a result of the safety system" in error_str.lower())
    ):

View on GitHub (pinned to 77b7c6c40c)