redis/redis-py · error · ResponseError

The server doesn't support maintenance notifications

Error message

The server doesn't support maintenance notifications

What it means

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.

Solutions

  1. Set maint_notifications_config.enabled='auto' so unsupported servers degrade gracefully (logged, not raised).
  2. Upgrade to a Redis build that supports maintenance notifications (Redis Cloud / Enterprise) if you truly need them.
  3. Disable maintenance notifications (enabled=False) when targeting OSS Redis or Valkey.
  4. Verify the server supports the feature with CLIENT INFO / docs before forcing enabled=True.

Example fix

# before
cfg = MaintNotificationsConfig(enabled=True, ...)
# after (graceful on unsupported servers)
cfg = MaintNotificationsConfig(enabled='auto', ...)
Defensive patterns

Strategy: validation

Validate before calling

# Prefer graceful degradation unless you REQUIRE maint notifications
from redis.maint_notifications import MaintNotificationsConfig
cfg = MaintNotificationsConfig(enabled='auto', ...)  # swallowed+logged if unsupported
# only use enabled=True when you have verified server support:
info = redis.Redis(host=h, port=p, protocol=3).info('server')
assert info.get('redis_version') and supports_maint_notifications(info)

Type guard

null

Try / catch

from redis.exceptions import ResponseError
try:
    r = redis.Redis(host=h, port=p, protocol=3, maint_notifications_config=cfg)
    r.ping()
except ResponseError as e:
    if 'maintenance notifications' in str(e).lower():
        # fall back to a plain connection without maint notifications
        r = redis.Redis(host=h, port=p, protocol=3)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10). Data as JSON: /api/errors/5b2a5459d6cbb55a. Report an issue: GitHub.

Appendix: source

Thrown at redis/connection.py:655

            host = getattr(self, "host", None)
            if host is None:
                raise ValueError(
                    "Cannot enable maintenance notifications for connection"
                    " object that doesn't have a host attribute."
                )
            else:
                endpoint_type = maint_notifications_config.get_endpoint_type(host, self)
                self.send_command(
                    "CLIENT",
                    "MAINT_NOTIFICATIONS",
                    "ON",
                    "moving-endpoint-type",
                    endpoint_type.value,
                    check_health=check_health,
                )
                response = self.read_response()
                if not response or str_if_bytes(response) != "OK":
                    raise ResponseError(
                        "The server doesn't support maintenance notifications"
                    )
        except Exception as e:
            if (
                isinstance(e, ResponseError)
                and maint_notifications_config.enabled == "auto"
            ):
                # Log warning but don't fail the connection
                import logging

                logger = logging.getLogger(__name__)
                logger.debug(f"Failed to enable maintenance notifications: {e}")
            else:
                raise

    def get_resolved_ip(self) -> Optional[str]:
        """
        Extract the resolved IP address from an

View on GitHub (pinned to 6a6b581b48)