{"record":{"id":"f4503db4285be5d3","repo":"BerriAI/litellm","slug":"multiple-authorization-headers-are-not-allowed","errorCode":null,"errorMessage":"Multiple Authorization headers are not allowed","messagePattern":"Multiple Authorization headers are not allowed","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py","lineNumber":1360,"sourceCode":"    @staticmethod\n    def _reject_duplicate_authorization(raw_headers: object) -> None:\n        \"\"\"Raise 400 when the raw ASGI headers carry more than one ``Authorization`` header.\"\"\"\n        if not isinstance(raw_headers, (list, tuple)):\n            return\n        count = 0\n        for entry in raw_headers:\n            if not isinstance(entry, (list, tuple)) or len(entry) < 1:\n                continue\n            name = entry[0]\n            if (\n                isinstance(name, (bytes, bytearray))\n                and bytes(name).lower() == b\"authorization\"\n                or isinstance(name, str)\n                and name.lower() == \"authorization\"\n            ):\n                count += 1\n        if count > 1:\n            raise HTTPException(\n                status_code=400,\n                detail=\"Multiple Authorization headers are not allowed\",\n            )\n\n    @staticmethod\n    async def get_allowed_mcp_servers(\n        user_api_key_auth: UserAPIKeyAuth | None = None,\n        *,\n        keyless_source: bool = False,\n    ) -> list[str]:\n        \"\"\"\n        Get list of allowed MCP servers for the given user/key based on permissions.\n\n        Permission hierarchy (all rules are intersections):\n        1. Get allowed servers from key permissions\n        2. Get allowed servers from team permissions (key inherits from team, or\n           intersection; or inherits nothing when require_key_mcp_access_defined\n           is enabled, making the team a ceiling rather than a default)","sourceCodeStart":1342,"sourceCodeEnd":1378,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py#L1342-L1378","documentation":"HTTP 400 from the duplicate-header check: the raw ASGI header list contains more than one Authorization header, which request-smuggling-style ambiguity the MCP auth path refuses to resolve by picking one.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py:1360 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send exactly one Authorization header; merge duplicates before sending."],"exampleFix":"headers={'Authorization': 'Bearer '+token}  # set once","handlingStrategy":"validation","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-14T05:17:10.506Z"}