{"record":{"id":"e3bcf06e973a9252","repo":"BerriAI/litellm","slug":"either-host-or-url-must-be-specified-for-redis","errorCode":null,"errorMessage":"Either 'host' or 'url' must be specified for redis.","messagePattern":"Either 'host' or 'url' must be specified for redis\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/_redis.py","lineNumber":475,"sourceCode":"\n    if \"url\" in redis_kwargs and redis_kwargs[\"url\"] is not None:\n        # Only strip host/port/db/password when not routing to a cluster.\n        # When startup_nodes is also present the cluster path takes priority and\n        # needs the password for authentication.\n        if not redis_kwargs.get(\"startup_nodes\"):\n            redis_kwargs.pop(\"host\", None)\n            redis_kwargs.pop(\"port\", None)\n            redis_kwargs.pop(\"db\", None)\n            redis_kwargs.pop(\"password\", None)\n    elif (\n        \"startup_nodes\" in redis_kwargs\n        and redis_kwargs[\"startup_nodes\"] is not None\n        or \"sentinel_nodes\" in redis_kwargs\n        and redis_kwargs[\"sentinel_nodes\"] is not None\n    ):\n        pass\n    elif \"host\" not in redis_kwargs or redis_kwargs[\"host\"] is None:\n        raise ValueError(\"Either 'host' or 'url' must be specified for redis.\")\n\n    # litellm.print_verbose(f\"redis_kwargs: {redis_kwargs}\")\n    return redis_kwargs\n\n\ndef init_redis_cluster(redis_kwargs) -> redis.RedisCluster:\n    _redis_cluster_nodes_in_env: Final[str | None] = get_secret(\"REDIS_CLUSTER_NODES\")\n    if _redis_cluster_nodes_in_env is not None:\n        try:\n            redis_kwargs[\"startup_nodes\"] = json.loads(_redis_cluster_nodes_in_env)\n        except json.JSONDecodeError:\n            raise ValueError(\n                \"REDIS_CLUSTER_NODES environment variable is not valid JSON. Please ensure it's properly formatted.\"\n            )\n\n    verbose_logger.debug(\"init_redis_cluster: startup nodes are being initialized.\")\n    from redis.cluster import ClusterNode\n","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/_redis.py#L457-L493","documentation":"Error \"Either 'host' or 'url' must be specified for redis.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/_redis.py:475 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass either host or url when constructing the Redis client."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}