{"id":"004f4c5667bdc0f2","repo":"redis/redis-py","slug":"maintenance-notifications-are-only-supported-with-004f4c","errorCode":null,"errorMessage":"Maintenance notifications are only supported with hiredis and RESP3 parsers!","messagePattern":"Maintenance notifications are only supported with hiredis and RESP3 parsers!","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/asyncio/connection.py","lineNumber":194,"sourceCode":"        self._processed_start_maint_notifications: set[int] = set()\n        self._skipped_end_maint_notifications: set[int] = set()\n        self._configure_maintenance_notifications(\n            maint_notifications_pool_handler,\n            orig_host_address,\n            orig_socket_timeout,\n            orig_socket_connect_timeout,\n            oss_cluster_maint_notifications_handler,\n            parser,\n        )\n\n    @abstractmethod\n    def _get_parser(self) -> BaseParser:\n        pass\n\n    def _get_push_notifications_parser(self) -> AsyncPushNotificationsParser:\n        parser = self._get_parser()\n        if not isinstance(parser, (_AsyncHiredisParser, _AsyncRESP3Parser)):\n            raise RedisError(\n                \"Maintenance notifications are only supported with hiredis and RESP3 parsers!\"\n            )\n        return parser\n\n    @abstractmethod\n    def get_protocol(self):\n        pass\n\n    @abstractmethod\n    async def send_command(self, *args: Any, **kwargs: Any) -> None:\n        pass\n\n    @abstractmethod\n    async def read_response(\n        self,\n        disable_decoding: bool = False,\n        timeout: float | None = None,\n        *,","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/asyncio/connection.py#L176-L212","documentation":"Raised by AbstractConnection._get_push_notifications_parser when the active parser is neither _AsyncHiredisParser nor _AsyncRESP3Parser. Maintenance-notification push messages are only decodable by the hiredis or RESP3 Python parsers; the RESP2 Python parser cannot handle out-of-band pushes, so the library refuses to expose the feature through it.","triggerScenarios":"Enabling maintenance notifications (maint_notifications_config.enabled) while the connection is configured to use the RESP2 Python parser (protocol=2 without hiredis installed, or parser_class explicitly set to _AsyncRESP2Parser) and then accessing the push-notifications parser.","commonSituations":"Forcing protocol=2 (RESP2) but still enabling maintenance notifications; running in an environment without hiredis installed where the pure-Python RESP2 parser is selected; upgrading redis-py and inheriting an old protocol=2 setting.","solutions":["Use RESP3: set protocol=3 (and install hiredis for best performance) so the parser can decode push notifications.","Disable maintenance notifications if you must stay on RESP2 (set maint_notifications_config.enabled = False).","Install hiredis (pip install redis[hiredis]) — the hiredis parser supports notifications and is protocol-flexible."],"exampleFix":"// before\nclient = Redis(url='redis://...', protocol=2, maint_notifications_config=cfg)\n// raises [89] when push parser is accessed\n// after\nclient = Redis(url='redis://...', protocol=3, maint_notifications_config=cfg)","handlingStrategy":"validation","validationCode":"from redis._parsers import _AsyncRESP3Parser, _AsyncHiredisParser\nif cfg.enabled and not isinstance(client.connection_pool.get_connection()._parser, (_AsyncHiredisParser, _AsyncRESP3Parser)):\n    raise ValueError('Enable RESP3 or install hiredis for maintenance notifications')","typeGuard":null,"tryCatchPattern":"from redis.exceptions import RedisError\ntry:\n    await client.ping()\nexcept RedisError as e:\n    if 'only supported with hiredis and RESP3' in str(e):\n        # rebuild with protocol=3 / install hiredis","preventionTips":["Use protocol=3 when you need maintenance notifications.","Install the hiredis extra for a supported, performant parser."],"tags":["connection","maintenance-notifications","parser","resp3","config"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}