{"record":{"id":"887982a11743a638","repo":"redis/redis-py","slug":"maintenance-notifications-are-not-supported-with","errorCode":null,"errorMessage":"Maintenance notifications are not supported with {connection_class}","messagePattern":"Maintenance notifications are not supported with (.+?)","errorType":"exception","errorClass":"RedisError","httpStatus":null,"severity":"error","filePath":"redis/connection.py","lineNumber":3017,"sourceCode":"        self._cache_factory = cache_factory\n\n        try:\n            supports_maint_notifications = issubclass(\n                connection_class, MaintNotificationsAbstractConnection\n            )\n            is_unix_domain_socket_connection = issubclass(\n                connection_class, UnixDomainSocketConnection\n            )\n        except TypeError:\n            supports_maint_notifications = False\n            is_unix_domain_socket_connection = False\n\n        if is_unix_domain_socket_connection or not supports_maint_notifications:\n            if (\n                maint_notifications_config\n                and maint_notifications_config.enabled is True\n            ):\n                raise RedisError(\n                    \"Maintenance notifications are not supported with \"\n                    f\"{connection_class}\"\n                )\n            maint_notifications_config = MaintNotificationsConfig(enabled=False)\n\n        self._event_dispatcher = self._connection_kwargs.get(\"event_dispatcher\", None)\n        if self._event_dispatcher is None:\n            self._event_dispatcher = EventDispatcher()\n\n        if connection_kwargs.get(\"cache_config\") or connection_kwargs.get(\"cache\"):\n            if not check_protocol_version(self._connection_kwargs.get(\"protocol\"), 3):\n                raise RedisError(\"Client caching is only supported with RESP version 3\")\n\n            cache = self._connection_kwargs.get(\"cache\")\n\n            if cache is not None:\n                if not isinstance(cache, CacheInterface):\n                    raise ValueError(\"Cache must implement CacheInterface\")","sourceCodeStart":2999,"sourceCodeEnd":3035,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/connection.py#L2999-L3035","documentation":"Raised as RedisError by ConnectionPool.__init__ when maint_notifications_config.enabled is True but the chosen connection_class is UnixDomainSocketConnection or any class that is not a subclass of MaintNotificationsAbstractConnection. The default redis.connection.Connection supports maintenance notifications; UDS and arbitrary custom classes do not, so enabling the feature against them is rejected up front.","triggerScenarios":"Constructing ConnectionPool(connection_class=UnixDomainSocketConnection, maint_notifications_config=MaintNotificationsConfig(enabled=True)). Passing a custom connection_class that does not subclass MaintNotificationsAbstractConnection with notifications enabled.","commonSituations":"Combining UDS connectivity with maintenance-notification config. Globally enabling maintenance notifications while a code path uses a UDS pool. Third-party/custom connection class used with the default RESP3 auto-enable.","solutions":["Use the default Connection class (TCP) when you need maintenance notifications.","If you need UDS, set maint_notifications_config=MaintNotificationsConfig(enabled=False) or omit it.","Make your custom connection_class inherit from MaintNotificationsAbstractConnection if you need notifications with it."],"exampleFix":"# before\npool = ConnectionPool(connection_class=UnixDomainSocketConnection,\n                    maint_notifications_config=MaintNotificationsConfig(enabled=True))\n# after\npool = ConnectionPool(connection_class=UnixDomainSocketConnection,\n                    maint_notifications_config=MaintNotificationsConfig(enabled=False))","handlingStrategy":"validation","validationCode":"from redis.connection import Connection, UnixDomainSocketConnection, MaintNotificationsAbstractConnection\n\ndef connection_supports_maint(connection_class) -> bool:\n    try:\n        return issubclass(connection_class, MaintNotificationsAbstractConnection)\n    except TypeError:\n        return False\n\nif maint_enabled and not connection_supports_maint(connection_class):\n    raise ValueError(f'{connection_class} does not support maintenance notifications')\n\npool = ConnectionPool(connection_class=connection_class, maint_notifications_config=cfg)","typeGuard":"from redis.connection import MaintNotificationsAbstractConnection\n\ndef supports_maint_notifications(connection_class) -> bool:\n    try:\n        return issubclass(connection_class, MaintNotificationsAbstractConnection)\n    except TypeError:\n        return False","tryCatchPattern":"from redis.exceptions import RedisError\ntry:\n    pool = ConnectionPool(connection_class=connection_class, maint_notifications_config=cfg)\nexcept RedisError:\n    pool = ConnectionPool(connection_class=connection_class,\n                          maint_notifications_config=MaintNotificationsConfig(enabled=False))","preventionTips":["Don't combine UDS (or custom non-maint classes) with maintenance notifications.","Check issubclass(connection_class, MaintNotificationsAbstractConnection) before enabling.","Default to enabled=False when using UDS."],"tags":["maintenance-notifications","configuration","connection-pool"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}