: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(plausible): stop retrying an unresolvable self-hosted host (#82436)
Tom Owersbddf7ac65c02
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/source.pyindex 54535bec8159..495eb5d4d13d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/source.py@@ -58,6 +58,11 @@ class PlausibleSource(ResumableSource[PlausibleSourceConfig, PlausibleResumeConf# missing-site cases are 401/403/404 and handled above). Retrying resends the same# request, so stop. Match the status text, not the self-hosted URL, which varies."400 Client Error": "Plausible rejected the request for this site. Check that the site domain is correct and that your Plausible account can access its stats, then reconnect.",+ # `is_database_host_valid` raises this when the self-hosted Host doesn't resolve via+ # DNS — a hostname the customer typed wrong or one that's no longer publicly reachable.+ # Deterministic and permanent until the Host is corrected, so stop retrying. Match the+ # stable prefix, not the customer's hostname that follows it.+ "Couldn't resolve the host": "The Plausible host could not be resolved via DNS. Check that it's spelled correctly and reachable from the public internet, then reconnect.",}@propertydiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/tests/test_plausible_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/tests/test_plausible_source.pyindex fcba0063b65c..8bc0ab84c93d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/tests/test_plausible_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/plausible/tests/test_plausible_source.py@@ -68,14 +68,27 @@ class TestSourceConfig:assert "401 Client Error" in errorsassert "403 Client Error" in errors- def test_bad_request_is_non_retryable(self):- # A 400 is a permanent rejection. The import layer classifies an error as non-retryable when- # a key is a substring of str(error), so match against the real requests HTTPError message.+ @pytest.mark.parametrize(+ "raised,expected_key",+ [+ # A 400 is a permanent rejection from Plausible for this site.+ ("400 Client Error: Bad Request for url: https://plausible.io/api/v2/query", "400 Client Error"),+ # A self-hosted Host that doesn't resolve via DNS is raised from source_for_pipeline's+ # host validation; retrying replays the same check, so it must stop.+ (+ "Couldn't resolve the host 'stats.example.com'. Check that it's spelled correctly "+ "and reachable from the public internet.",+ "Couldn't resolve the host",+ ),+ ],+ )+ def test_permanent_errors_are_non_retryable(self, raised: str, expected_key: str):+ # The import layer classifies an error as non-retryable when a key is a substring of+ # str(error), so match against the real message shape each path produces.errors = PlausibleSource().get_non_retryable_errors()- raised = "400 Client Error: Bad Request for url: https://plausible.io/api/v2/query"matched = [key for key in errors if key in raised]- assert matched == ["400 Client Error"]- assert errors["400 Client Error"] is not None+ assert matched == [expected_key]+ assert errors[expected_key] is not Noneclass TestGetSchemas: