{"record":{"id":"48ce59046c4acf24","repo":"BerriAI/litellm","slug":"invalid-saml-configuration-e","errorCode":null,"errorMessage":"Invalid SAML configuration: {e}","messagePattern":"Invalid SAML configuration: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/sso/saml_sso.py","lineNumber":237,"sourceCode":"            \"get_data\": dict(request.query_params),\n            \"post_data\": post_data or {},\n        }\n\n    @staticmethod\n    async def _build_auth(\n        request: Request,\n        cache: DualCache,\n        post_data: dict[str, str] | None = None,\n    ) -> \"OneLogin_Saml2_Auth\":\n        if not SAML_AVAILABLE:\n            raise _saml_unavailable_error()\n        idp_settings: Final = await SAMLAuthHandler._load_idp_settings(cache)\n        settings: Final = SAMLAuthHandler._build_settings(request, idp_settings)\n        request_data: Final = SAMLAuthHandler._prepare_request_data(request, post_data)\n        try:\n            return OneLogin_Saml2_Auth(request_data, old_settings=settings)\n        except Exception as e:  # noqa: BLE001 - toolkit exposes no common exception base; fail closed\n            raise HTTPException(\n                status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,\n                detail=f\"Invalid SAML configuration: {e}\",\n            )\n\n    @staticmethod\n    async def build_login_redirect(\n        request: Request, cache: DualCache, relay_state: str | None = None\n    ) -> RedirectResponse:\n        auth: Final = await SAMLAuthHandler._build_auth(request, cache)\n        redirect_url: Final = cast(str, auth.login(return_to=relay_state))  # cast-ok: untyped python3-saml\n        response: Final = RedirectResponse(url=redirect_url, status_code=303)\n        request_id: Final = cast(str | None, auth.get_last_request_id())  # cast-ok: untyped python3-saml\n        if request_id is not None:\n            cache.set_cache(\n                key=f\"{_SAML_AUTHN_REQUEST_CACHE_PREFIX}:{request_id}\",\n                value=\"1\",\n                ttl=_SAML_AUTHN_REQUEST_TTL_SECONDS,\n            )","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/sso/saml_sso.py#L219-L255","documentation":"_build_auth wraps OneLogin_Saml2_Settings construction: any malformed combination of SP/IdP settings (bad cert format, mismatched URLs, bad entity ids) raises OneLogin_Saml2_Error, which is translated into this 500-class HTTPException naming the underlying cause.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/sso/saml_sso.py:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the SAML configuration values (metadata, entity ids, certificates).","Check proxy logs for the underlying parse error."],"exampleFix":null,"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"}