BerriAI/litellm · error · HTTPException

major_airlines.json not found

Error message

major_airlines.json not found

What it means

Raised by the major-airlines guardrail UI endpoint when the packaged competitor-intent data file (guardrail_hooks/litellm_content_filter/competitor_intent/major_airlines.json) is unexpectedly absent from the installation. Delivered as 404; it indicates a broken/incomplete package install rather than any caller error — the file ships with LiteLLM.

Source

Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:1476

@router.get(
    "/guardrails/ui/major_airlines",
    tags=["Guardrails"],
    dependencies=[Depends(user_api_key_auth)],
)
async def get_major_airlines():
    """
    Get the major airlines list from IATA (competitor intent, airline type).
    Returns airline id, match variants (pipe-separated), and tags.
    """
    airlines_path: Final = os.path.join(
        os.path.dirname(__file__),
        "guardrail_hooks",
        "litellm_content_filter",
        "competitor_intent",
        "major_airlines.json",
    )
    if not os.path.exists(airlines_path):
        raise HTTPException(
            status_code=404,
            detail="major_airlines.json not found",
        )
    try:
        with open(airlines_path, "r", encoding="utf-8") as f:
            import json

            airlines: Final = json.load(f)
        return {"airlines": airlines}
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"Error reading major_airlines.json: {e}") from e


@router.post(
    "/guardrails/validate_blocked_words_file",
    tags=["Guardrails"],
    dependencies=[Depends(user_api_key_auth)],
)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Ensure major_airlines.json is present in the expected package data directory.
  2. Reinstall the litellm package if data files are missing.

Example fix

pip install --force-reinstall litellm
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:1476 when the library encounters an invalid state.

Common situations: The bundled major_airlines.json data file is missing from the installation.


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