{"record":{"id":"cb3ecf651bbc915f","repo":"redis/redis-py","slug":"maintenance-notifications-handlers-on-connection-a-cb3ecf","errorCode":null,"errorMessage":"Maintenance notifications handlers on connection are only supported with RESP version 3","messagePattern":"Maintenance notifications handlers on connection are only supported with RESP version 3","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/client.py","lineNumber":492,"sourceCode":"                            \"ssl_ocsp_expected_cert\": ssl_ocsp_expected_cert,\n                            \"ssl_min_version\": ssl_min_version,\n                            \"ssl_ciphers\": ssl_ciphers,\n                        }\n                    )\n                if (cache_config or cache) and check_protocol_version(protocol, 3):\n                    kwargs.update(\n                        {\n                            \"cache\": cache,\n                            \"cache_config\": cache_config,\n                        }\n                    )\n                maint_notifications_enabled = (\n                    maint_notifications_config and maint_notifications_config.enabled\n                )\n                if maint_notifications_enabled and not check_protocol_version(\n                    protocol, 3\n                ):\n                    raise RedisError(\n                        \"Maintenance notifications handlers on connection are only supported with RESP version 3\"\n                    )\n                if maint_notifications_config:\n                    kwargs.update(\n                        {\n                            \"maint_notifications_config\": maint_notifications_config,\n                        }\n                    )\n                if oss_cluster_maint_notifications_handler:\n                    kwargs.update(\n                        {\n                            \"oss_cluster_maint_notifications_handler\": oss_cluster_maint_notifications_handler,\n                        }\n                    )\n            connection_pool = ConnectionPool(**kwargs)\n            self._event_dispatcher.dispatch(\n                AfterPooledConnectionsInstantiationEvent(\n                    [connection_pool], ClientType.SYNC, credential_provider","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/client.py#L474-L510","documentation":"Raised as RedisError during Redis.__init__ when maintenance notifications are enabled but the negotiated protocol version is not RESP3. Maintenance notifications are delivered as RESP3 push messages, so they require protocol=3. check_protocol_version(protocol, 3) returns False for protocol 2 or the library default if it resolves to non-3, triggering the error.","triggerScenarios":"Constructing Redis(maint_notifications_config=..., protocol=2) or omitting protocol while the effective default is not 3, with maint_notifications_config.enabled True. The check at client.py:489-494 fires during pool kwargs assembly.","commonSituations":"Enabling maintenance notifications on a client pinned to RESP2 for compatibility. Forgetting to set protocol=3 in a config that enables notifications. An environment/library version where the default protocol is not 3.","solutions":["Set protocol=3 when enabling maintenance notifications.","Disable maintenance notifications if you must stay on RESP2.","Confirm the Redis server supports RESP3 (Redis 6+)."],"exampleFix":"# before\nr = Redis(maint_notifications_config=MaintNotificationsConfig(enabled=True),\n         protocol=2)  # RedisError\n# after\nr = Redis(maint_notifications_config=MaintNotificationsConfig(enabled=True),\n         protocol=3)","handlingStrategy":"validation","validationCode":"if maint_notifications_config and maint_notifications_config.enabled and protocol not in (3, \"3\"):\n    raise ValueError(\"maintenance notifications require protocol=3\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pair maintenance notifications with protocol=3 always.","Centralize protocol/feature compatibility checks in a config builder."],"tags":["configuration","maintenance-notifications","resp3","protocol"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}