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): treat unresolvable database hostname as non-retryable (#63706)

Tom Owersf6bb97b96800
diff --git a/posthog/temporal/data_imports/sources/postgres/source.py b/posthog/temporal/data_imports/sources/postgres/source.py
index a2ac3d597521..b4bfd9faaf8a 100644
--- a/posthog/temporal/data_imports/sources/postgres/source.py
+++ b/posthog/temporal/data_imports/sources/postgres/source.py
@@ -199,6 +199,11 @@ class PostgresSource(SQLSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDa
"QueryTimeoutException": None,
"TemporaryFileSizeExceedsLimitException": None,
"Name or service not known": None,
+ # Sibling getaddrinfo failure to "Name or service not known" (EAI_NONAME): EAI_NODATA
+ # surfaces as "[Errno -5] No address associated with hostname". Both mean the customer's
+ # database host doesn't resolve to an address — a config/DNS issue on their side that
+ # retrying won't fix.
+ "No address associated with hostname": None,
"Network is unreachable": None,
# `InsufficientPrivilege` is the psycopg exception class name. It only appears once
# Temporal wraps the activity failure (`ApplicationError` stringifies as
diff --git a/posthog/temporal/data_imports/sources/postgres/test_postgres.py b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
index af0a688cceb9..cead7ffdb2ca 100644
--- a/posthog/temporal/data_imports/sources/postgres/test_postgres.py
+++ b/posthog/temporal/data_imports/sources/postgres/test_postgres.py
@@ -146,6 +146,7 @@ class TestPostgresSourceNonRetryableErrors:
'FATAL: password authentication failed for user "myuser"',
'FATAL: no such database "nonexistent_db"',
"Name or service not known",
+ "OperationalError: [Errno -5] No address associated with hostname",
"BaseSSHTunnelForwarderError: Could not establish session to SSH gateway",
# Newer Supabase/Supavisor pooler wording for a missing tenant/user. The older
# "Tenant or user not found connection to server" / "FATAL: Tenant or user not found"