Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(postgres): map pooler missing-tenant error during credential validation (#64393)

Tom Owers36321f3a8df3
diff --git a/posthog/temporal/data_imports/sources/postgres/source.py b/posthog/temporal/data_imports/sources/postgres/source.py
index 37c9bac11485..eeba8f0b35c4 100644
--- a/posthog/temporal/data_imports/sources/postgres/source.py
+++ b/posthog/temporal/data_imports/sources/postgres/source.py
@@ -54,6 +54,17 @@ PostgresErrors = {
"password authentication failed for user": "Invalid user or password",
# libpq reports a bad password via SCRAM with a different wording than the line above.
"error received from server in SCRAM exchange: Wrong password": "Invalid user or password",
+ # Supabase/Supavisor poolers report a missing tenant/user during credential validation with
+ # "FATAL: (ENOTFOUND) tenant/user <user> not found" — the project is paused/deleted or the
+ # pooler username/host is wrong. `get_non_retryable_errors` already handles this on the
+ # streaming path; map it here too so validation returns an actionable message instead of
+ # surfacing the expected user/upstream condition as captured error noise. Match the stable
+ # fragment and exclude the volatile username/host.
+ "(ENOTFOUND) tenant/user": (
+ "Your database connection pooler couldn't find the tenant or user. This usually means the "
+ "database project is paused or deleted, or the pooler username/host is wrong. Check that "
+ "your database is active and the connection details are correct."
+ ),
"could not translate host name": "Could not connect to the host",
"Is the server running on that host and accepting TCP/IP connections": "Could not connect to the host on the port given",
'database "': "Database does not exist",
diff --git a/posthog/temporal/data_imports/sources/postgres/test_postgres.py b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
index 082689a062fd..a0366364babb 100644
--- a/posthog/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
@@ -1404,6 +1404,14 @@ class TestValidateCredentialsErrorMapping:
"pool_size, or switch it to transaction mode) or reduce the number of concurrent "
"connections to your database, then try again.",
),
+ # Supabase/Supavisor pooler reports a missing tenant/user with a volatile username/host.
+ (
+ 'connection failed: connection to server at "44.216.29.125", port 5432 failed: '
+ "FATAL: (ENOTFOUND) tenant/user postgres.icjrfprdtrgjpxfpbrvx not found",
+ "Your database connection pooler couldn't find the tenant or user. This usually means the "
+ "database project is paused or deleted, or the pooler username/host is wrong. Check that "
+ "your database is active and the connection details are correct.",
+ ),
# Unmapped errors fall back to the generic message.
(
"some brand new failure",