{"record":{"id":"6f2e7f28ae98460b","repo":"BerriAI/litellm","slug":"router-not-initialized-6f2e7f","errorCode":null,"errorMessage":"Router not initialized","messagePattern":"Router not initialized","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/utils.py","lineNumber":1065,"sourceCode":"    ) -> object:\n        \"\"\"\n        Execute a guardrail using the router's load balancing.\n\n        Args:\n            guardrail_name: Name of the guardrail\n            hook_type: One of \"pre_call\", \"during_call\", \"post_call\"\n            data: Request data\n            user_api_key_dict: User API key auth\n            call_type: Type of call\n            response: Response object (for post_call hooks)\n\n        Returns:\n            Result from the guardrail execution\n        \"\"\"\n        from litellm.proxy.proxy_server import llm_router\n\n        if llm_router is None:\n            raise ValueError(\"Router not initialized\")\n\n        # Select guardrail using router's load balancing\n        selected_guardrail: Final = llm_router.get_available_guardrail(guardrail_name=guardrail_name)\n\n        callback: Final[CustomGuardrail | None] = selected_guardrail.get(\"callback\")\n        if callback is None:\n            raise ValueError(f\"No callback found for guardrail: {guardrail_name}\")\n\n        return await self._execute_guardrail_hook(\n            callback=callback,\n            hook_type=hook_type,\n            data=data,\n            user_api_key_dict=user_api_key_dict,\n            call_type=call_type,\n            response=response,\n        )\n\n    async def _process_guardrail_callback(","sourceCodeStart":1047,"sourceCodeEnd":1083,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/utils.py#L1047-L1083","documentation":"Runtime guard when executing a guardrail via the router: llm_router on proxy_server is None, meaning no models (and hence no router) were configured — typically the proxy started with an empty config or the router failed to initialize. Guardrail resolution cannot proceed without it.","triggerScenarios":"Thrown at litellm/proxy/utils.py:1065 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the proxy/router finished initializing before invoking this code path; check startup logs for errors."],"exampleFix":null,"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"}