{"record":{"id":"eea354bd72ff386f","repo":"BerriAI/litellm","slug":"error-reading-category-file-e","errorCode":null,"errorMessage":"Error reading category file: {e}","messagePattern":"Error reading category file: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_endpoints.py","lineNumber":1455,"sourceCode":"        file_type = \"json\"\n    else:\n        raise HTTPException(\n            status_code=404,\n            detail=f\"Category file not found: {category_name} (tried .yaml and .json)\",\n        )\n\n    try:\n        # Read and return the raw content\n        with open(category_file_path, \"r\") as f:\n            content: Final = f.read()\n\n        return {\n            \"category_name\": category_name,\n            \"yaml_content\": content,  # Keep key name for backwards compatibility\n            \"file_type\": file_type,\n        }\n    except Exception as e:\n        raise HTTPException(status_code=500, detail=f\"Error reading category file: {e}\")\n\n\n@router.get(\n    \"/guardrails/ui/major_airlines\",\n    tags=[\"Guardrails\"],\n    dependencies=[Depends(user_api_key_auth)],\n)\nasync def get_major_airlines():\n    \"\"\"\n    Get the major airlines list from IATA (competitor intent, airline type).\n    Returns airline id, match variants (pipe-separated), and tags.\n    \"\"\"\n    airlines_path: Final = os.path.join(\n        os.path.dirname(__file__),\n        \"guardrail_hooks\",\n        \"litellm_content_filter\",\n        \"competitor_intent\",\n        \"major_airlines.json\",","sourceCodeStart":1437,"sourceCodeEnd":1473,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_endpoints.py#L1437-L1473","documentation":"Raised in the guardrail category-content endpoint when opening or reading the resolved category file (.yaml/.json under the packaged categories directory) throws an unexpected OS-level exception — permissions, file removed between checks, or decode issues. The original exception text is embedded; delivered as HTTP 500 since it is a server-side file-access failure.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:1455 when the library encounters an invalid state.","commonSituations":"The category file exists but could not be read or parsed.","solutions":["Check proxy logs for the file read error (permissions, malformed content).","Validate the category file is well-formed YAML/JSON."],"exampleFix":"python -c \"import yaml; yaml.safe_load(open('category.yaml'))\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}