{"record":{"id":"86af59153258da13","repo":"redis/redis-py","slug":"database-health-check-url-is-not-set-please-check","errorCode":null,"errorMessage":"Database health check url is not set. Please check DatabaseConfig for the current database.","messagePattern":"Database health check url is not set\\. Please check DatabaseConfig for the current database\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"redis/asyncio/multidb/healthcheck.py","lineNumber":470,"sourceCode":"        )\n        self._rest_api_port = rest_api_port\n        self._lag_aware_tolerance = lag_aware_tolerance\n        super().__init__(\n            health_check_probes=health_check_probes,\n            health_check_delay=health_check_delay,\n            health_check_timeout=health_check_timeout,\n        )\n\n    async def check_health(self, database, hc_client: AsyncRedisClientT) -> bool:\n        \"\"\"\n        Check database health via Redis Enterprise REST API.\n\n        Note: The client parameter is not used for this health check as it\n        relies on the REST API instead of Redis protocol. The client is\n        accepted for interface compatibility.\n        \"\"\"\n        if database.health_check_url is None:\n            raise ValueError(\n                \"Database health check url is not set. Please check DatabaseConfig for the current database.\"\n            )\n\n        if isinstance(database.client, (AsyncRedis, SyncRedis)):\n            db_host = database.client.get_connection_kwargs()[\"host\"]\n        else:\n            # Cluster client\n            db_host = database.client.get_nodes()[0].host\n\n        base_url = f\"{database.health_check_url}:{self._rest_api_port}\"\n        self._http_client.client.base_url = base_url\n\n        # Find bdb matching to the current database host\n        matching_bdb = None\n        for bdb in await self._http_client.get(\"/v1/bdbs\"):\n            for endpoint in bdb[\"endpoints\"]:\n                if endpoint[\"dns_name\"] == db_host:\n                    matching_bdb = bdb","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/asyncio/multidb/healthcheck.py#L452-L488","documentation":"Raised as a ValueError inside LagAwareHealthCheck.check_health when the DatabaseConfig for the current database has health_check_url set to None. The lag-aware health check queries the Redis Enterprise REST API to measure replication lag, so it needs an explicit REST API base URL to talk to. Without that URL there is no endpoint to probe, so the check refuses to run.","triggerScenarios":"Calling check_health() on a LagAwareHealthCheck instance whose database entry has database.health_check_url == None. This happens when the DatabaseConfig was constructed without passing a health_check_url (e.g. a multidb client built from plain Redis URIs instead of Redis Enterprise REST API metadata).","commonSituations":"Pointing the multidb client at a standalone Redis or Redis Cloud non-Enterprise deployment that does not expose the /v1 REST API. Forgetting to set health_check_url when programmatically assembling DatabaseConfig objects. Migrating from a simpler health check to LagAwareHealthCheck without updating the config builder.","solutions":["Set DatabaseConfig.health_check_url to the Redis Enterprise REST API base URL (e.g. https://cluster-host) before starting the health check.","If you are not on Redis Enterprise, switch to a non-lag-aware health check class that does not require the REST API.","Verify the multidb config loader actually populates health_check_url from your environment or discovery response."],"exampleFix":"# before\ndb = DatabaseConfig(client=client, health_check_url=None)\nawait lag_hc.check_health(db, client)\n# after\ndb = DatabaseConfig(client=client, health_check_url=\"https://enterprise-cluster-host\")\nawait lag_hc.check_health(db, client)","handlingStrategy":"validation","validationCode":"if getattr(database, \"health_check_url\", None) is None:\n    raise ValueError(\"health_check_url not configured; cannot run LagAwareHealthCheck\")\nawait lag_hc.check_health(database, client)","typeGuard":"def has_health_check_url(db) -> bool:\n    return getattr(db, \"health_check_url\", None) is not None","tryCatchPattern":"try:\n    await lag_hc.check_health(database, client)\nexcept ValueError as e:\n    if \"health check url\" in str(e):\n        logger.error(\"Lag health check skipped: %s\", e)\n    else:\n        raise","preventionTips":["Always set health_check_url when building DatabaseConfig for Redis Enterprise.","Validate multidb config at startup and fail fast if health_check_url is missing."],"tags":["multidb","health-check","redis-enterprise","configuration"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}