{"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/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/client.py#L474-L510","documentation":"Raised as RedisError in Redis.__init__ (redis/client.py:492) when maint_notifications_config.enabled is True but the negotiated protocol is not RESP3. Maintenance-notification handlers rely on RESP3 server-pushed messages (push types), which do not exist in RESP2, so the client rejects the combination at construction.","triggerScenarios":"Constructing Redis with maint_notifications_config.enabled=True and protocol omitted/2 (or a server that negotiates RESP2); explicitly setting protocol=2 with maint notifications on.","commonSituations":"Defaulting protocol while enabling maint notifications on an older Redis that only speaks RESP2; explicitly pinning protocol=2 elsewhere in config; template enabling maint notifications without bumping protocol.","solutions":["Set protocol=3 when enabling maintenance notifications.","Upgrade the Redis server to >=7.0 (RESP3-capable) if needed.","Disable maintenance notifications if you must stay on RESP2."],"exampleFix":"# before\nr = Redis(host='localhost', protocol=2,\n         maint_notifications_config=MaintNotificationsConfig(enabled=True))  # RedisError\n# after\nr = Redis(host='localhost', protocol=3,\n         maint_notifications_config=MaintNotificationsConfig(enabled=True))","handlingStrategy":"validation","validationCode":"from redis._parsers.helpers import check_protocol_version\nif maint_notifications_config.enabled and not check_protocol_version(protocol, 3):\n    raise ConfigError('Maintenance notifications require protocol=3')","typeGuard":"def resp3_enabled(protocol) -> bool:\n    from redis._parsers.helpers import check_protocol_version\n    return check_protocol_version(protocol, 3)","tryCatchPattern":"try:\n    r = Redis(protocol=protocol, maint_notifications_config=cfg)\nexcept RedisError as e:\n    logger.error('need RESP3 for maint notifications: %s', e)\n    raise","preventionTips":["Set protocol=3 whenever maintenance notifications are enabled.","Ensure the server is RESP3-capable (Redis >=7.0)."],"tags":["config","maintenance-notifications","resp3"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}