redis/redis-py · error · RedisError

Maintenance notifications are only supported with hiredis an

Error message

Maintenance notifications are only supported with hiredis and RESP3 parsers!

What it means

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.

Source

Thrown at redis/asyncio/connection.py:194

        self._processed_start_maint_notifications: set[int] = set()
        self._skipped_end_maint_notifications: set[int] = set()
        self._configure_maintenance_notifications(
            maint_notifications_pool_handler,
            orig_host_address,
            orig_socket_timeout,
            orig_socket_connect_timeout,
            oss_cluster_maint_notifications_handler,
            parser,
        )

    @abstractmethod
    def _get_parser(self) -> BaseParser:
        pass

    def _get_push_notifications_parser(self) -> AsyncPushNotificationsParser:
        parser = self._get_parser()
        if not isinstance(parser, (_AsyncHiredisParser, _AsyncRESP3Parser)):
            raise RedisError(
                "Maintenance notifications are only supported with hiredis and RESP3 parsers!"
            )
        return parser

    @abstractmethod
    def get_protocol(self):
        pass

    @abstractmethod
    async def send_command(self, *args: Any, **kwargs: Any) -> None:
        pass

    @abstractmethod
    async def read_response(
        self,
        disable_decoding: bool = False,
        timeout: float | None = None,
        *,

View on GitHub (pinned to da03cdc7e8)

Solutions

  1. Use RESP3: set protocol=3 (and install hiredis for best performance) so the parser can decode push notifications.
  2. Disable maintenance notifications if you must stay on RESP2 (set maint_notifications_config.enabled = False).
  3. Install hiredis (pip install redis[hiredis]) — the hiredis parser supports notifications and is protocol-flexible.

Example fix

// before
client = Redis(url='redis://...', protocol=2, maint_notifications_config=cfg)
// raises [89] when push parser is accessed
// after
client = Redis(url='redis://...', protocol=3, maint_notifications_config=cfg)
Defensive patterns

Strategy: validation

Validate before calling

from redis._parsers import _AsyncRESP3Parser, _AsyncHiredisParser
if cfg.enabled and not isinstance(client.connection_pool.get_connection()._parser, (_AsyncHiredisParser, _AsyncRESP3Parser)):
    raise ValueError('Enable RESP3 or install hiredis for maintenance notifications')

Try / catch

from redis.exceptions import RedisError
try:
    await client.ping()
except RedisError as e:
    if 'only supported with hiredis and RESP3' in str(e):
        # rebuild with protocol=3 / install hiredis

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of redis/redis-py@da03cdc7e8 (2026-08-04). Data as JSON: /data/errors/004f4c5667bdc0f2.json. Report an issue: GitHub.