BerriAI/litellm · error · HTTPException

Error reading major_airlines.json: {e}

Error message

Error reading major_airlines.json: {e}

What it means

Raised by the major-airlines endpoint when major_airlines.json exists but json.load or the surrounding read raises (corrupt JSON, encoding problem, or mid-read IO error). The original exception text is embedded and the endpoint returns 500 — this is data-file corruption on the server, not a request problem.

Source

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

        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)],
)
async def validate_blocked_words_file(request: dict[str, str]):
    """
    Validate a blocked_words YAML file content.

    Args:
        request: Dictionary with 'file_content' key containing the YAML string

    Returns:
        Dictionary with 'valid' boolean and either 'message'/'errors' depending on result

    Example Request:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check proxy logs for the read error and verify major_airlines.json is valid JSON.

Example fix

python -m json.tool major_airlines.json
Defensive patterns

Strategy: try-catch

When it happens

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

Common situations: major_airlines.json exists but could not be read or parsed.


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