{"record":{"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":"error","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/6a6b581b48225afa0b76912d1028c6035baee932/redis/connection.py#L637-L673","documentation":"Raised in _enable_maintenance_notifications after sending CLIENT MAINT_NOTIFICATIONS ON when the server response is not 'OK'. The CLIENT MAINT_NOTIFICATIONS subcommand only exists on Redis (and Redis Cloud / Active-Active) builds that support maintenance events; an older or OSS-only server returns an error or non-OK reply. With config.enabled=='auto' this is swallowed and logged at debug level (connection.py:660-667); with enabled=True it propagates as a ResponseError and fails the connection.","triggerScenarios":"Connecting with maint_notifications_config.enabled=True (not 'auto') to a Redis server that does not implement the CLIENT MAINT_NOTIFICATIONS command (standard OSS Redis, older versions, Valkey). The send/read at connection.py:645-653 returns a non-OK response, raising ResponseError at :655.","commonSituations":"Using a maintenance-notifications-enabled client against a local dev Redis or a managed Redis that is not Redis Cloud/Enterprise; version mismatch where the feature was expected; copying a cloud-prod config to an OSS environment.","solutions":["Set maint_notifications_config.enabled='auto' so unsupported servers degrade gracefully (logged, not raised).","Upgrade to a Redis build that supports maintenance notifications (Redis Cloud / Enterprise) if you truly need them.","Disable maintenance notifications (enabled=False) when targeting OSS Redis or Valkey.","Verify the server supports the feature with CLIENT INFO / docs before forcing enabled=True."],"exampleFix":"# before\ncfg = MaintNotificationsConfig(enabled=True, ...)\n# after (graceful on unsupported servers)\ncfg = MaintNotificationsConfig(enabled='auto', ...)","handlingStrategy":"validation","validationCode":"# Prefer graceful degradation unless you REQUIRE maint notifications\nfrom redis.maint_notifications import MaintNotificationsConfig\ncfg = MaintNotificationsConfig(enabled='auto', ...)  # swallowed+logged if unsupported\n# only use enabled=True when you have verified server support:\ninfo = redis.Redis(host=h, port=p, protocol=3).info('server')\nassert info.get('redis_version') and supports_maint_notifications(info)","typeGuard":"null","tryCatchPattern":"from redis.exceptions import ResponseError\ntry:\n    r = redis.Redis(host=h, port=p, protocol=3, maint_notifications_config=cfg)\n    r.ping()\nexcept ResponseError as e:\n    if 'maintenance notifications' in str(e).lower():\n        # fall back to a plain connection without maint notifications\n        r = redis.Redis(host=h, port=p, protocol=3)\n    else:\n        raise","preventionTips":["Default to enabled='auto' for portability across server builds.","Document which server flavor (Redis Cloud/Enterprise) the feature needs.","Probe server capabilities before forcing enabled=True."],"tags":["maintenance-notifications","server-compatibility","redis-version","configuration"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}