{"record":{"id":"029ec4de00c7744f","repo":"redis/redis-py","slug":"maintenance-notifications-are-only-supported-with","errorCode":null,"errorMessage":"Maintenance notifications are only supported with RESP version 3","messagePattern":"Maintenance notifications are only supported with RESP version 3","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/asyncio/cluster.py","lineNumber":573,"sourceCode":"        # Build the client-level HIMPORT registry once (always empty at construction)\n        # and share the same object with every node connection. It rides in\n        # connection_kwargs -> ClusterNode -> each node's Connection, so the registry is\n        # shared cluster-wide and runtime himport_prepare mutates one object. (Async has\n        # no per-node Redis client, so the object flows via connection_kwargs directly to\n        # the Connection, which is internal plumbing, not a public param.)\n        self._himport_registry = HImportRegistry()\n        kwargs[\"himport_registry\"] = self._himport_registry\n\n        self.connection_kwargs = kwargs\n\n        # Validate maint_notifications_config before NodesManager is constructed\n        # so that a bad config doesn't leak an open NodesManager.\n        if (\n            maint_notifications_config\n            and maint_notifications_config.enabled\n            and not check_protocol_version(protocol, 3)\n        ):\n            raise RedisError(\n                \"Maintenance notifications are only supported with RESP version 3\"\n            )\n        if check_protocol_version(protocol, 3) and maint_notifications_config is None:\n            maint_notifications_config = MaintNotificationsConfig()\n        # Initialize to None so aclose() and any error-path code never sees an\n        # unset slot, even if __init__ raises before the mixin runs.\n        self._oss_cluster_maint_notifications_handler = None\n\n        if startup_nodes:\n            passed_nodes = []\n            for node in startup_nodes:\n                passed_nodes.append(\n                    ClusterNode(node.host, node.port, **self.connection_kwargs)\n                )\n            startup_nodes = passed_nodes\n        else:\n            startup_nodes = []\n        if host and port:","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/asyncio/cluster.py#L555-L591","documentation":"Cluster-mode counterpart of error 40: RedisCluster.__init__ validates maint_notifications_config before constructing NodesManager, and raises RedisError if enabled=True but protocol != 3. Validated early so a bad config does not leak an open NodesManager.","triggerScenarios":"RedisCluster(host=..., port=..., maint_notifications_config=MaintNotificationsConfig(enabled=True), protocol=2); or enabling notifications on a cluster client while the deployment default protocol is RESP2.","commonSituations":"Enabling server-pushed maintenance notifications on a cluster whose other clients still negotiate RESP2; upgrading a cluster deployment and forgetting to bump protocol to 3.","solutions":["Set protocol=3 on the RedisCluster(...) call that enables maint notifications.","If RESP2 is mandatory, leave maint_notifications_config=None / enabled=False.","Confirm the cluster runs Redis >= 7.x with RESP3 push support."],"exampleFix":"// before\nclient = RedisCluster(\n    host='localhost', port=7000,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True),\n    protocol=2,\n)\n// after\nclient = RedisCluster(\n    host='localhost', port=7000,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True),\n    protocol=3,\n)","handlingStrategy":"validation","validationCode":"from redis._parsers.helpers import check_protocol_version\nif maint_cfg and maint_cfg.enabled and not check_protocol_version(protocol, 3):\n    raise ValueError('enable RESP3 (protocol=3) before cluster maint notifications')","typeGuard":"def can_use_cluster_maint_notifications(protocol: int | None) -> bool:\n    return check_protocol_version(protocol, 3)","tryCatchPattern":"try:\n    client = RedisCluster(host=..., port=..., maint_notifications_config=cfg, protocol=protocol)\nexcept RedisError as e:\n    if 'RESP version 3' in str(e):\n        client = RedisCluster(host=..., port=..., maint_notifications_config=None, protocol=protocol)\n    else:\n        raise","preventionTips":["Pair maint_notifications_config with protocol=3 in a single config helper.","Unit-test the pairing for cluster clients."],"tags":["cluster","resp3","maintenance-notifications","configuration"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}