: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(custom): stop retrying a 404 from a custom source URL (#79520)
Tom Owersa6d4f25fe5d5
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/custom/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/custom/source.pyindex 3df0f608ce7b..e937a1d41b61 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/custom/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/custom/source.py@@ -880,6 +880,10 @@ class CustomSource(SimpleSource[CustomSourceConfig]):# is entirely manifest-driven, so a 400 is deterministic: the same request recurs on# every retry. Stop retrying and point at the config the user can actually change."400 Client Error": "The upstream API rejected the request with HTTP 400. Check the resource's path, query params, and — for an incremental sync — the cursor's date format in the manifest, then try again.",+ # A configured URL or resource path that doesn't exist. The request shape is+ # manifest-driven, so the 404 recurs on every retry — stop and point at the config.+ # The message omits the URL, which carries the customer's hostname.+ "404 Client Error": "The upstream API returned HTTP 404 Not Found. Check that the base URL and the resource's path in the manifest are correct and that the endpoint exists, then try again.",# A schema points to a resource the manifest no longer defines (renamed or removed# in an edit while the table's sync stayed scheduled). Permanent until the config is# fixed — match the stable suffix, not the variable resource name in the message.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/custom/test_custom_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/custom/test_custom_source.pyindex bb506408d82d..d156f0a9e7ee 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/custom/test_custom_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/custom/test_custom_source.py@@ -3005,3 +3005,16 @@ class TestCustomSourceOAuth2NonRetryableClassification(SimpleTestCase):assert not ctx.exception.is_permanentassert OAUTH2_PERMANENT_ERROR_MARKER not in str(ctx.exception)assert not _classify_non_retryable(ctx.exception), str(ctx.exception)+++class TestCustomSourceHttpNonRetryableClassification(SimpleTestCase):+ def test_404_is_non_retryable_with_a_url_free_message(self):+ # A 404 on a manifest-configured URL is deterministic, so it must be classified+ # non-retryable to stop the loop, and its message must not echo the customer's hostname.+ # Classification is a substring match on str(error), so the exception type doesn't matter;+ # a plain Exception carries the realistic message without requests' typed constructor.+ error = Exception("404 Client Error: Not Found for url: https://host.example.com/export")+ non_retryable = CustomSource().get_non_retryable_errors()+ assert _classify_non_retryable(error)+ matched = [message for key, message in non_retryable.items() if key in str(error)]+ assert matched and all(message is not None and "://" not in message for message in matched)