BerriAI/litellm · error · HTTPException

Invalid fallback_type. Must be one of: {valid_fallback_types

Error message

Invalid fallback_type. Must be one of: {valid_fallback_types}

What it means

Enum validation when building model-limit metadata: the fallback_type argument is not one of the recognized values (e.g. 'generic'/'context-window'). The valid set is listed in the message; the caller (or config) supplied an unsupported fallback classification.

Source

Thrown at litellm/proxy/utils.py:7046

        configured_input, configured_output = llm_router.get_configured_token_limits(model_id)
        if configured_input is not None:
            max_input_tokens = configured_input
        if configured_output is not None:
            max_output_tokens = configured_output

    if max_input_tokens is not None:
        base["max_input_tokens"] = max_input_tokens
    if max_output_tokens is not None:
        base["max_output_tokens"] = max_output_tokens

    if not include_metadata:
        return base

    effective_fallback_type: Final = fallback_type if fallback_type is not None else "general"

    valid_fallback_types: Final = ["general", "context_window", "content_policy"]
    if effective_fallback_type not in valid_fallback_types:
        raise HTTPException(
            status_code=400,
            detail=f"Invalid fallback_type. Must be one of: {valid_fallback_types}",
        )

    fallbacks: Final = get_all_fallbacks(
        model=model_id,
        llm_router=llm_router,
        fallback_type=effective_fallback_type,
    )
    return {**base, "metadata": {"fallbacks": fallbacks}}


def validate_model_access(
    model_id: str,
    available_models: list[str],
) -> None:
    """
    Validate that a model is accessible to the user.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set fallback_type to one of the listed valid values.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/utils.py:7046 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/f11443ff2c939e18. Report an issue: GitHub.