{"id":"b2cecac4aae97084","repo":"redis/redis-py","slug":"maintenance-notifications-are-not-supported-for-co-b2ceca","errorCode":null,"errorMessage":"Maintenance notifications are not supported for connections without a host","messagePattern":"Maintenance notifications are not supported for connections without a host","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/asyncio/connection.py","lineNumber":1933,"sourceCode":"                            \"Maintenance notifications are not supported for \"\n                            \"Unix domain socket connections\"\n                        )\n\n                    # Custom connection classes must inherit the async maintenance\n                    # mixin so handlers can update connection state safely.\n                    if not self._maintenance_notifications_connection_class_supported():\n                        connection_class = getattr(self, \"connection_class\", None)\n                        connection_class_name = getattr(\n                            connection_class, \"__name__\", connection_class\n                        )\n                        raise RedisError(\n                            \"Maintenance notifications are not supported for \"\n                            f\"connection class {connection_class_name}\"\n                        )\n\n                    # TCP-like connections still need a host to identify the\n                    # endpoint that can move during maintenance.\n                    raise RedisError(\n                        \"Maintenance notifications are not supported for connections \"\n                        \"without a host\"\n                    )\n                self._maint_notifications_pool_handler = None\n                self._oss_cluster_maint_notifications_handler = None\n                return\n\n            if not is_protocol_supported:\n                raise RedisError(\n                    \"Maintenance notifications handlers on connection are only supported with RESP version 3\"\n                )\n\n            if oss_cluster_maint_notifications_handler:\n                self._oss_cluster_maint_notifications_handler = (\n                    oss_cluster_maint_notifications_handler\n                )\n                self._update_connection_kwargs_for_maint_notifications(\n                    oss_cluster_maint_notifications_handler=self._oss_cluster_maint_notifications_handler","sourceCodeStart":1915,"sourceCodeEnd":1951,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/asyncio/connection.py#L1915-L1951","documentation":"Raised as a RedisError when maintenance notifications are explicitly enabled, the connection is not a Unix socket and uses a supported class, but there is no 'host' in connection_kwargs. CLIENT MAINT_NOTIFICATIONS identifies an endpoint by host, so a TCP-like connection without a host cannot be tracked. This is the fallthrough after the UDS and class checks at lines 1913/1921.","triggerScenarios":"Constructing a pool with maint_notifications_config enabled=True where connection_kwargs omits 'host' (e.g. a custom connection class that does not set host, or a misconfigured pool). The check at line 1998 (_maintenance_notifications_supported) requires a truthy 'host'.","commonSituations":"A custom connection class that connects by some non-host identifier but is not a UDS; manually building a pool with connection kwargs that drop 'host'; enabling the feature on an abstract/incomplete configuration.","solutions":["Ensure connection_kwargs includes a valid 'host' (TCP endpoint).","Disable maintenance notifications if the connection has no host identity.","Use the standard Connection with host/port so the feature has an endpoint to register."],"exampleFix":"// before\npool = ConnectionPool(connection_class=MyHostlessConn,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))\n\n// after\npool = ConnectionPool(host=\"redis.local\", port=6379,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))","handlingStrategy":"validation","validationCode":"def maint_notifications_has_host(connection_kwargs: dict) -> bool:\n    return bool(connection_kwargs.get(\"host\")) and \"path\" not in connection_kwargs","typeGuard":null,"tryCatchPattern":"from redis.exceptions import RedisError\ntry:\n    pool = ConnectionPool(connection_kwargs=kwargs, maint_notifications_config=cfg)\nexcept RedisError as e:\n    if \"without a host\" in str(e):\n        pool = ConnectionPool(host=\"redis.local\", port=6379, maint_notifications_config=cfg)\n    else:\n        raise","preventionTips":["Ensure a 'host' is set when enabling maintenance notifications.","Use the standard Connection with host/port.","Don't strip host from connection_kwargs when customizing pools."],"tags":["maintenance-notifications","config","connection","async"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}