{"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":572,"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":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/asyncio/cluster.py#L554-L590","documentation":"Raised by RedisCluster.__init__ (redis/asyncio/cluster.py:572) when maint_notifications_config is enabled but the protocol is not RESP3 — the cluster-side mirror of [40]. Maintenance notifications are RESP3 push messages; the cluster client validates this before constructing NodesManager so a bad config does not leak an open manager. Raises RedisError.","triggerScenarios":"Constructing RedisCluster(..., maint_notifications_config=MaintNotificationsConfig(enabled=True), protocol=2). The guard checks enabled and not check_protocol_version(protocol, 3).","commonSituations":"Enabling maintenance notifications in a cluster deployment pinned to RESP2; copying a maintenance example into protocol=2 code.","solutions":["Set protocol=3 on the RedisCluster constructor.","If RESP3 is unavailable, disable maintenance notifications (enabled=False or omit the config).","Confirm every cluster node runs Redis >= 6 (RESP3 support) before enabling."],"exampleFix":"// before\nc = RedisCluster(host='localhost', port=16379, protocol=2,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))\n// after\nc = RedisCluster(host='localhost', port=16379, protocol=3,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))","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 protocol=3 for cluster maintenance notifications')\nc = RedisCluster(host=host, port=port, protocol=protocol, maint_notifications_config=maint_cfg)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate maintenance-notification config behind a protocol=3 assertion in the client factory.","Verify all cluster nodes support RESP3 before enabling.","Add a CI matrix case combining maintenance notifications with protocol=3."],"tags":["redis","asyncio","cluster","configuration","resp3","maintenance-notifications"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}