{"record":{"id":"e4a86ea683606a30","repo":"BerriAI/litellm","slug":"both-sentinel-nodes-and-service-name-are-requi","errorCode":null,"errorMessage":"Both 'sentinel_nodes' and 'service_name' are required for Redis Sentinel.","messagePattern":"Both 'sentinel_nodes' and 'service_name' are required for Redis Sentinel\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/_redis.py","lineNumber":537,"sourceCode":"    args: Final = _get_redis_kwargs()\n    for arg in redis_kwargs:\n        if arg in args:\n            connection_kwargs[arg] = redis_kwargs[arg]\n\n    return connection_kwargs\n\n\ndef _init_redis_sentinel(redis_kwargs) -> redis.Redis:\n    sentinel_nodes: Final = redis_kwargs.get(\"sentinel_nodes\")\n    sentinel_password: Final = redis_kwargs.get(\"sentinel_password\")\n    service_name: Final = redis_kwargs.get(\"service_name\")\n    connection_kwargs: Final = _get_redis_sentinel_connection_kwargs(redis_kwargs)\n    connection_kwargs.setdefault(\"socket_timeout\", REDIS_SOCKET_TIMEOUT)\n    sentinel_kwargs: Final = dict(connection_kwargs)\n    sentinel_kwargs[\"password\"] = sentinel_password\n\n    if not sentinel_nodes or not service_name:\n        raise ValueError(\"Both 'sentinel_nodes' and 'service_name' are required for Redis Sentinel.\")\n\n    verbose_logger.debug(\"init_redis_sentinel: sentinel nodes are being initialized.\")\n\n    # Set up the Sentinel client\n    sentinel: Final = redis.Sentinel(\n        sentinel_nodes,\n        sentinel_kwargs=sentinel_kwargs,\n    )\n\n    # Return the master instance for the given service\n\n    return sentinel.master_for(service_name, **connection_kwargs)\n\n\ndef _init_async_redis_sentinel(redis_kwargs) -> async_redis.Redis:\n    sentinel_nodes: Final = redis_kwargs.get(\"sentinel_nodes\")\n    sentinel_password: Final = redis_kwargs.get(\"sentinel_password\")\n    service_name: Final = redis_kwargs.get(\"service_name\")","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/_redis.py#L519-L555","documentation":"_init_redis_sentinel() in litellm/_redis.py requires both sentinel_nodes and service_name in redis_kwargs; missing either raises ValueError before the redis.Sentinel client is built. service_name selects which monitored master to use (sentinel.master_for(service_name)); sentinel_nodes lists the sentinel process addresses.","triggerScenarios":"Configuring cache with sentinel support: passing sentinel_nodes=[{'host':..,'port':26379}] but omitting service_name (or vice versa); env-based setup where REDIS_SERVICE_NAME is unset; typos like service or master_name instead of service_name.","commonSituations":"Migrating from a plain Redis deployment to Redis Sentinel and copying the nodes but not the master name; Helm chart values missing the sentinel service name; assuming the master name defaults to 'mymaster' (litellm requires it explicitly).","solutions":["Pass both: RedisCache(sentinel_nodes=[{\"host\":\"sentinel-1\",\"port\":26379}], service_name=\"mymaster\")","Or supply the equivalent env/config keys your deployment uses for sentinel (e.g. REDIS_SERVICE_NAME alongside sentinel nodes)","Confirm the service_name matches the monitored master name configured on the sentinels (SENTINEL monitor <name> ...)","Typo-check keys: sentinel_nodes (plural) and service_name exactly"],"exampleFix":"# before\nRedisCache(sentinel_nodes=[{\"host\":\"sentinel\",\"port\":26379}])\n# ValueError: Both 'sentinel_nodes' and 'service_name' are required for Redis Sentinel.\n\n# after\nRedisCache(\n    sentinel_nodes=[{\"host\":\"sentinel-1\",\"port\":26379}, {\"host\":\"sentinel-2\",\"port\":26379}],\n    service_name=\"mymaster\",\n)","handlingStrategy":"validation","validationCode":"def validate_sentinel_config(cfg: dict) -> None:\n    nodes = cfg.get(\"sentinel_nodes\")\n    service = cfg.get(\"service_name\")\n    if not nodes or not service:\n        raise ValueError(\n            \"Redis Sentinel needs both sentinel_nodes=[{host,port},...] and \"\n            \"service_name=<monitored master name>\"\n        )","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Template sentinel config as a unit (nodes + service_name together) so one can't ship without the other","Confirm service_name equals the name in the sentinel's `SENTINEL monitor <name>` config (often 'mymaster')","Add a config lint for cache sections that flags sentinel_nodes without service_name"],"tags":["redis","sentinel","configuration","cache","validation","startup"],"backgroundTag":"missing-configuration","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}