: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): treat 400 Bad Request as non-retryable (#71647)
Tom Owers09bb14cd274f
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 659e28d0d229..3a23a713634e 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@@ -55,6 +55,10 @@ class PlausibleSource(ResumableSource[PlausibleSourceConfig, PlausibleResumeConfreturn {"401 Client Error": "Your Plausible API key is invalid or has been revoked. Create a new key in your Plausible account settings, then reconnect.","403 Client Error": "Your Plausible API key is missing the stats read scope needed to sync this data. Grant it in your Plausible account settings, then reconnect.",+ # Plausible rejects the query as malformed for this site (a permanent 400 — auth and+ # 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.",}@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 e2df924763f6..bcaa56e942f8 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,6 +68,15 @@ 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.+ 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+class TestGetSchemas:def test_all_endpoints_present_and_incremental(self):