{"id":"0b315a006c51ee55","repo":"redis/redis-py","slug":"maintenance-notifications-are-not-supported-for-co","errorCode":null,"errorMessage":"Maintenance notifications are not supported for connection class {connection_class_name}","messagePattern":"Maintenance notifications are not supported for connection class (.+?)","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/asyncio/connection.py","lineNumber":1926,"sourceCode":"        if maint_notifications_config and maint_notifications_config.enabled:\n            if not is_connection_supported:\n                if maint_notifications_config.enabled is True:\n                    # Unix sockets do not have a host endpoint for CLIENT\n                    # MAINT_NOTIFICATIONS to describe.\n                    if \"path\" in self.connection_kwargs:\n                        raise RedisError(\n                            \"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                )","sourceCodeStart":1908,"sourceCodeEnd":1944,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/asyncio/connection.py#L1908-L1944","documentation":"Raised as a RedisError when maintenance notifications are explicitly enabled but the configured connection_class does not inherit from AsyncMaintNotificationsAbstractConnection (checked by _maintenance_notifications_connection_class_supported via issubclass). Custom connection classes must adopt the mixin so handlers can safely update connection state on notification events.","triggerScenarios":"Passing connection_class=MyCustomConnection (which does not subclass AsyncMaintNotificationsAbstractConnection) together with maint_notifications_config enabled=True, or with an oss_cluster_maint_notifications_handler. The connection_class name is included in the message.","commonSituations":"Using a third-party/custom connection class that predates the maintenance-notifications API; wrapping the standard Connection for instrumentation without inheriting the mixin; enabling OSS-cluster maint notifications on a client whose pool uses a non-supported class.","solutions":["Make your custom connection class inherit AsyncMaintNotificationsAbstractConnection (and Connection).","Disable maintenance notifications (enabled=False / omit the config) if you do not need them.","Use the built-in Connection class, which already satisfies the check."],"exampleFix":"// before\nclass MyConn(redis.asyncio.Connection): ...\nr = redis.asyncio.Redis(connection_class=MyConn,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))\n\n// after\nclass MyConn(redis.asyncio.Connection, AsyncMaintNotificationsAbstractConnection): ...\nr = redis.asyncio.Redis(connection_class=MyConn,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))","handlingStrategy":"type-guard","validationCode":"from redis.asyncio.connection import AsyncMaintNotificationsAbstractConnection\ndef connection_class_supports_maint(cls) -> bool:\n    try:\n        return issubclass(cls, AsyncMaintNotificationsAbstractConnection)\n    except TypeError:\n        return False","typeGuard":"def supports_maintenance_notifications(connection_class) -> bool:\n    from redis.asyncio.connection import AsyncMaintNotificationsAbstractConnection\n    try:\n        return issubclass(connection_class, AsyncMaintNotificationsAbstractConnection)\n    except TypeError:\n        return False","tryCatchPattern":"from redis.exceptions import RedisError\ntry:\n    pool = ConnectionPool(connection_class=MyConn, maint_notifications_config=cfg)\nexcept RedisError as e:\n    if \"connection class\" in str(e):\n        pool = ConnectionPool(connection_class=MyConn)  # no maint notifications\n    else:\n        raise","preventionTips":["Subclass AsyncMaintNotificationsAbstractConnection for custom connection classes used with maint notifications.","Don't force enabled=True on unsupported connection classes.","Prefer the built-in Connection for the maintenance-notifications feature."],"tags":["maintenance-notifications","config","connection-class","async"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}