{"record":{"id":"d2f7beaaaeee166d","repo":"redis/redis-py","slug":"maintenance-notifications-are-only-supported-with-d2f7be","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/connection.py","lineNumber":386,"sourceCode":"        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        self._processed_start_maint_notifications = set()\n        self._skipped_end_maint_notifications = set()\n\n    @abstractmethod\n    def _get_parser(self) -> BaseParser:\n        pass\n\n    def _get_push_notifications_parser(self) -> Union[_HiredisParser, _RESP3Parser]:\n        parser = self._get_parser()\n        if not isinstance(parser, (_HiredisParser, _RESP3Parser)):\n            raise RedisError(\n                \"Maintenance notifications are only supported with hiredis and RESP3 parsers!\"\n            )\n        return parser\n\n    @abstractmethod\n    def _get_socket(self) -> Optional[socket.socket]:\n        pass\n\n    @abstractmethod\n    def get_protocol(self) -> Union[int, str]:\n        \"\"\"\n        Returns:\n            The RESP protocol version, or ``None`` if the protocol is not specified,\n            in which case the server default will be used.\n        \"\"\"\n        pass\n\n    @property","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/connection.py#L368-L404","documentation":"Raised by AbstractConnection._get_push_notifications_parser() when the active parser is not a HiredisParser or RESP3 (_RESP3Parser). Maintenance (push) notifications require a parser that understands RESP3 push messages, so a pure RESP2 parser cannot be used to read them.","triggerScenarios":"Triggering maintenance-notification handling (e.g., enabling oss_cluster maint notifications) on a connection whose parser is the pure-Python RESP2 parser. This happens when protocol=2 is in effect or hiredis is unavailable and protocol defaulted to RESP2.","commonSituations":"OSS cluster maint-notification feature enabled without ensuring RESP3/hiredis. Forcing protocol=2 globally. Environment without hiredis installed where the feature expects it.","solutions":["Use protocol=3 (RESP3) so the RESP3 parser is selected.","Install hiredis (pip install redis[hiredis]) so the hiredis parser is available.","Disable maintenance notifications if you cannot move to RESP3/hiredis."],"exampleFix":"// before\nclient = Redis(host=..., protocol=2,\n    # maint notifications enabled elsewhere\n)\n// after\nclient = Redis(host=..., protocol=3)\n# and ensure hiredis is installed: pip install redis[hiredis]","handlingStrategy":"validation","validationCode":"from redis.connection import _HiredisParser, _RESP3Parser\nparser = conn._get_parser()\nif not isinstance(parser, (_HiredisParser, _RESP3Parser)):\n    raise RuntimeError('enable RESP3/hiredis to use maintenance notifications')","typeGuard":"from redis.connection import _HiredisParser, _RESP3Parser\n\ndef supports_push_notifications(parser) -> bool:\n    return isinstance(parser, (_HiredisParser, _RESP3Parser))","tryCatchPattern":"try:\n    conn._get_push_notifications_parser()\nexcept RedisError:\n    # fall back to non-maintenance path or reconfigure protocol\n    raise","preventionTips":["Standardize on protocol=3 when using maintenance notifications.","Install the hiredis extra in production images."],"tags":["connection","maintenance-notifications","resp3","hiredis","parser"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}