{"id":"5b2a5459d6cbb55a","repo":"redis/redis-py","slug":"the-server-doesn-t-support-maintenance-notificatio-5b2a54","errorCode":null,"errorMessage":"The server doesn't support maintenance notifications","messagePattern":"The server doesn't support maintenance notifications","errorType":"exception","errorClass":"ResponseError","httpStatus":null,"severity":"warning","filePath":"redis/connection.py","lineNumber":655,"sourceCode":"            host = getattr(self, \"host\", None)\n            if host is None:\n                raise ValueError(\n                    \"Cannot enable maintenance notifications for connection\"\n                    \" object that doesn't have a host attribute.\"\n                )\n            else:\n                endpoint_type = maint_notifications_config.get_endpoint_type(host, self)\n                self.send_command(\n                    \"CLIENT\",\n                    \"MAINT_NOTIFICATIONS\",\n                    \"ON\",\n                    \"moving-endpoint-type\",\n                    endpoint_type.value,\n                    check_health=check_health,\n                )\n                response = self.read_response()\n                if not response or str_if_bytes(response) != \"OK\":\n                    raise ResponseError(\n                        \"The server doesn't support maintenance notifications\"\n                    )\n        except Exception as e:\n            if (\n                isinstance(e, ResponseError)\n                and maint_notifications_config.enabled == \"auto\"\n            ):\n                # Log warning but don't fail the connection\n                import logging\n\n                logger = logging.getLogger(__name__)\n                logger.debug(f\"Failed to enable maintenance notifications: {e}\")\n            else:\n                raise\n\n    def get_resolved_ip(self) -> Optional[str]:\n        \"\"\"\n        Extract the resolved IP address from an","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/connection.py#L637-L673","documentation":"Raised as a ResponseError when the CLIENT MAINT_NOTIFICATIONS ON command returns anything other than 'OK', meaning the connected Redis server does not support maintenance notifications (an enterprise/Cloud moving-endpoint feature). When the config's enabled mode is 'auto', the error is swallowed and only logged at debug level; in any other mode it propagates and fails the connection.","triggerScenarios":"Connecting with maint_notifications_config.enabled (not 'auto') to a Redis server (e.g. open-source Redis) that does not understand CLIENT MAINT_NOTIFICATIONS. The on_connect path calls _enable_maintenance_notifications, sends the command, and the server returns an error or non-OK reply.","commonSituations":"Pointing a client configured for Redis Cloud / Enterprise maintenance notifications at a plain OSS Redis instance; version mismatch where the server predates the feature; typo in the config causing enabled to be a truthy non-'auto' value.","solutions":["Set maint_notifications_config.enabled = 'auto' so unsupported servers degrade gracefully instead of failing the connection.","Disable maintenance notifications entirely when targeting OSS Redis.","Connect to a Redis deployment that supports maintenance notifications (Redis Cloud/Enterprise)."],"exampleFix":"// before\ncfg = MaintNotificationsConfig(enabled=True)\nclient = redis.Redis(host=h, maint_notifications_config=cfg)\n// after\ncfg = MaintNotificationsConfig(enabled='auto')\nclient = redis.Redis(host=h, maint_notifications_config=cfg)","handlingStrategy":"fallback","validationCode":"# before connecting, decide whether the target supports maintenance notifications\nfrom redis.maint_notifications import MaintNotificationsConfig\ncfg = MaintNotificationsConfig(enabled='auto')  # degrades gracefully on unsupported servers","typeGuard":null,"tryCatchPattern":"from redis.exceptions import ResponseError\ntry:\n    client.ping()\nexcept ResponseError as e:\n    if 'maintenance notifications' in str(e):\n        # server lacks support; reconnect with maint disabled or enabled='auto'\n        pass","preventionTips":["Use enabled='auto' when targeting mixed/OSS Redis deployments.","Disable maintenance notifications for servers known not to support them."],"tags":["maintenance-notifications","server-compatibility","configuration"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}