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(warehouse): map Supavisor auth-failure circuit breaker (#88321)

posthog[bot]6e82be08fa9d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
index a7a60c556b5e..e7dd8e40f119 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/source.py
@@ -475,6 +475,18 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa
"require a pooler-specific username such as postgres.<project-ref>. Check your "
"credentials, then re-enable the sync."
),
+ # Supabase/Supavisor trips its circuit breaker after repeated bad credentials and refuses
+ # new connections with "FATAL: (ECIRCUITBREAKER) too many authentication failures, new
+ # connections are temporarily blocked". The block only clears once the failing attempts
+ # stop, so it's deterministic until the customer fixes the credentials — retrying just
+ # re-hits the block. Distinct from the transient credential-fetch variant of the same
+ # code, which postgres.py keeps retrying (see `_CONNECTION_DROPPED_ERROR_SUBSTRINGS`).
+ "too many authentication failures": (
+ "Your database connection pooler is blocking new connections after too many failed "
+ 'sign-in attempts ("too many authentication failures"). This usually means the '
+ "username or password is wrong. Check your credentials, wait for the block to clear, "
+ "then re-enable the sync."
+ ),
# A Postgres server configured with `pam` auth in pg_hba.conf rejects bad credentials with
# "FATAL: PAM authentication failed for user <user>" instead of PostgreSQL's
# "password authentication failed for user", so the password key above doesn't
@@ -488,21 +500,6 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa
"through PAM (for example against the system password database or LDAP), and it "
"rejected the username or password. Check your credentials, then re-enable the sync."
),
- # Supavisor trips its own circuit breaker after repeated authentication failures against
- # a tenant and temporarily refuses new connects, reporting "FATAL: (ECIRCUITBREAKER) too
- # many authentication failures, new connections are temporarily blocked". Distinct from
- # the pooler-bookkeeping "(ECIRCUITBREAKER) failed to retrieve database credentials"
- # variant kept retryable in postgres.py's `_CONNECTION_DROPPED_ERROR_SUBSTRINGS` — this one
- # is tripped by the credentials themselves being rejected repeatedly, so it's the same
- # deterministic class as "password authentication failed" and retrying with the same
- # credentials just re-trips the breaker. Match the stable message, excluding the volatile
- # host/port the raw driver text prefixes it with.
- "too many authentication failures": (
- "Your database's connection pooler has temporarily blocked new connections after "
- 'repeated authentication failures ("too many authentication failures"). This usually '
- "means the configured username or password is wrong. Check your credentials, then "
- "re-enable the sync."
- ),
"could not translate host name": _DNS_RESOLUTION_ERROR,
"timeout expired connection to server at": None,
"password authentication failed for user": _INVALID_CREDENTIALS_ERROR,
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
index 3ad05de93ba6..57f6dc1f6258 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py
@@ -455,6 +455,10 @@ class TestPostgresSourceNonRetryableErrors:
# hit a plan limit. Account-level state only the customer can lift, so retrying re-hits
# the same refusal — must not keep retrying. Host/port are invented, not a real value.
'connection failed: connection to server at "db.example.com", port 5432 failed: Your account has restrictions: planLimitReached. Please contact your provider to resolve account restrictions.',
+ # Supabase/Supavisor trips its circuit breaker after repeated bad credentials. The block
+ # stays until the failing attempts stop, so it's permanent until the customer fixes the
+ # credentials — distinct from the transient credential-fetch variant of the same code.
+ 'connection failed: connection to server at "10.0.0.1", port 5432 failed: FATAL: (ECIRCUITBREAKER) too many authentication failures, new connections are temporarily blocked',
# The target database has datallowconn off, or a managed provider paused/suspended it
# (SQLSTATE 57P03). Permanent until the customer restores it, so it must not keep retrying.
# Distinct from the transient "not yet accepting connections" startup refusal above (which
@@ -2081,7 +2085,7 @@ class TestIsConnectionDroppedError:
# kept retryable above. Broadening the match to the bare code would wrongly retry a
# deterministic credential rejection — see `get_non_retryable_errors` in source.py.
psycopg.OperationalError(
- 'connection failed: connection to server at "18.176.230.146", port 5432 failed: '
+ 'connection failed: connection to server at "10.0.0.1", port 5432 failed: '
"FATAL: (ECIRCUITBREAKER) too many authentication failures, new connections are "
"temporarily blocked"
),
@@ -4440,7 +4444,7 @@ class TestValidateCredentialsErrorMapping:
# themselves keep being rejected, so it must surface actionable credential guidance
# instead of falling through to the generic fallback message below.
(
- 'connection failed: connection to server at "18.176.230.146", port 5432 failed: '
+ 'connection failed: connection to server at "10.0.0.1", port 5432 failed: '
"FATAL: (ECIRCUITBREAKER) too many authentication failures, new connections are "
"temporarily blocked",
"Your database's connection pooler has temporarily blocked new connections after "