{"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":3002,"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":2984,"sourceCodeEnd":3020,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/connection.py#L2984-L3020","documentation":"Raised as a RedisError by ConnectionPool.__init__ (connection.py:2997-3005) when maint_notifications_config.enabled is True but the connection_class is UnixDomainSocketConnection or a class that does not subclass MaintNotificationsAbstractConnection (checked via issubclass at lines 2987-2995). Maintenance notifications require a connection class that implements the notification-handling protocol.","triggerScenarios":"Constructing a pool with connection_class=UnixDomainSocketConnection (or a custom class not derived from MaintNotificationsAbstractConnection) while passing an enabled MaintNotificationsConfig. Unix sockets and custom transports are explicitly excluded.","commonSituations":"Enabling maintenance notifications globally in shared config that is then applied to a UDS-based pool; using a custom connection class for testing/specialized transports and inheriting notifications config; mixing notification config into a pool meant for local unix-socket Redis.","solutions":["Disable maintenance notifications for Unix-socket or unsupported connection classes: pass MaintNotificationsConfig(enabled=False) (the constructor does this automatically when the class is unsupported and config is not explicitly enabled).","Use a TCP Connection (the default) if maintenance notifications are required.","If using a custom connection_class, ensure it subclasses MaintNotificationsAbstractConnection before enabling notifications."],"exampleFix":"# before\nfrom redis.maint_notifications import MaintNotificationsConfig\npool = redis.ConnectionPool(\n    connection_class=redis.UnixDomainSocketConnection,\n    path=\"/var/run/redis/redis.sock\",\n    maint_notifications_config=MaintNotificationsConfig(enabled=True))\n\n# after (disable notifications for UDS)\npool = redis.ConnectionPool(\n    connection_class=redis.UnixDomainSocketConnection,\n    path=\"/var/run/redis/redis.sock\",\n    maint_notifications_config=MaintNotificationsConfig(enabled=False))","handlingStrategy":"validation","validationCode":"from redis.connection import UnixDomainSocketConnection\nfrom redis.maint_notifications import MaintNotificationsConfig\n\ndef safe_pool(connection_class, enabled, **kw):\n    if enabled and connection_class in (UnixDomainSocketConnection,):\n        enabled = False\n    cfg = MaintNotificationsConfig(enabled=enabled)\n    return redis.ConnectionPool(connection_class=connection_class, maint_notifications_config=cfg, **kw)","typeGuard":"from redis.connection import MaintNotificationsAbstractConnection, UnixDomainSocketConnection\ndef supports_maint_notifications(connection_class) -> bool:\n    try:\n        return (issubclass(connection_class, MaintNotificationsAbstractConnection)\n                and not issubclass(connection_class, UnixDomainSocketConnection))\n    except TypeError:\n        return False","tryCatchPattern":"from redis.exceptions import RedisError\ntry:\n    pool = redis.ConnectionPool(connection_class=cls, maint_notifications_config=cfg, **kw)\nexcept RedisError as e:\n    if \"not supported with\" in str(e):\n        cfg = MaintNotificationsConfig(enabled=False)\n        pool = redis.ConnectionPool(connection_class=cls, maint_notifications_config=cfg, **kw)\n    else:\n        raise","preventionTips":["Do not enable maintenance notifications on Unix-socket pools.","If using a custom connection_class, confirm it subclasses MaintNotificationsAbstractConnection before enabling.","Keep notification config separate from UDS/local pools in shared config."],"tags":["maintenance-notifications","configuration","validation","connection"],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}