{"id":"9fb6abfa31a0587e","repo":"redis/redis-py","slug":"maintenance-notifications-handlers-on-connection-a","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/asyncio/client.py","lineNumber":469,"sourceCode":"                            \"ssl_keyfile\": ssl_keyfile,\n                            \"ssl_certfile\": ssl_certfile,\n                            \"ssl_cert_reqs\": ssl_cert_reqs,\n                            \"ssl_include_verify_flags\": ssl_include_verify_flags,\n                            \"ssl_exclude_verify_flags\": ssl_exclude_verify_flags,\n                            \"ssl_ca_certs\": ssl_ca_certs,\n                            \"ssl_ca_data\": ssl_ca_data,\n                            \"ssl_ca_path\": ssl_ca_path,\n                            \"ssl_check_hostname\": ssl_check_hostname,\n                            \"ssl_min_version\": ssl_min_version,\n                            \"ssl_ciphers\": ssl_ciphers,\n                            \"ssl_password\": ssl_password,\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(protocol, 3):\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            # This arg only used if no pool is passed in\n            self.auto_close_connection_pool = auto_close_connection_pool\n            connection_pool = ConnectionPool(**kwargs)\n            self._event_dispatcher.dispatch(\n                AfterPooledConnectionsInstantiationEvent(\n                    [connection_pool], ClientType.ASYNC, credential_provider\n                )\n            )\n        else:\n            # If a pool is passed in, do not close it","sourceCodeStart":451,"sourceCodeEnd":487,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/asyncio/client.py#L451-L487","documentation":"Raised in the async Redis client constructor (redis/asyncio/client.py:469) when a MaintenanceNotificationsConfig with enabled=True is supplied but the wire protocol is not RESP3. Maintenance notifications are a RESP3-only server push mechanism, so the library refuses to construct a client that would silently never receive them. It raises a plain RedisError at construction time.","triggerScenarios":"Constructing redis.asyncio.Redis(..., maint_notifications_config=MaintNotificationsConfig(enabled=True)) together with protocol=2 (or omitting protocol in an environment where it resolves to a non-3 default override). The guard fires before any connection is opened, so it is a synchronous init-time failure.","commonSituations":"Copying a maintenance-notifications example that assumes RESP3 into code that explicitly sets protocol=2 for RESP2 compatibility; upgrading redis-py to use maintenance notifications without bumping the protocol; CI that forces protocol=2 across the matrix while a feature test enables maintenance notifications.","solutions":["Pass protocol=3 to the Redis(...) constructor so RESP3 is negotiated and maintenance pushes are delivered.","If you cannot use RESP3, remove the maint_notifications_config argument or set enabled=False.","Verify with `await client.connection_pool.get_connection().on_connect()`/HELLO that the server itself supports RESP3 (Redis >= 6)."],"exampleFix":"// before\nr = redis.asyncio.Redis(\n    protocol=2,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True),\n)\n// after\nr = redis.asyncio.Redis(\n    protocol=3,\n    maint_notifications_config=MaintNotificationsConfig(enabled=True),\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 protocol=3 before enabling maintenance notifications\")\nr = redis.asyncio.Redis(protocol=protocol, maint_notifications_config=maint_cfg)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Centralize client construction in a factory that asserts protocol=3 whenever maintenance notifications are enabled.","Run the protocol x features matrix in CI to catch feature/protocol mismatches early."],"tags":["redis","asyncio","configuration","resp3","maintenance-notifications"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}