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(paddle): treat 404 not-found responses as non-retryable (#72090)

Tom Owersf63c3e27bbea
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/source.py
index 837f77508f7b..5bb87bdfa56b 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/source.py
@@ -78,6 +78,10 @@ class PaddleSource(ResumableSource[PaddleSourceConfig, PaddleResumeConfig]):
"400 Client Error: Bad Request for url: https://api.paddle.com": "Paddle rejected the request parameters. Please check your source configuration and incremental sync state, then try again.",
"401 Client Error: Unauthorized for url: https://api.paddle.com": "Your Paddle API key is invalid or expired. Please check your API key in Paddle and reconnect.",
"403 Client Error: Forbidden for url: https://api.paddle.com": "Your Paddle API key does not have the required permissions. Please check your API key permissions in Paddle and try again.",
+ # 404 on a list endpoint we know exists means the resource isn't reachable for this
+ # account — Paddle Billing isn't enabled, or the API key belongs to a different
+ # environment (sandbox vs. production) than the data. Retrying can't change that.
+ "404 Client Error: Not Found for url: https://api.paddle.com": "Paddle couldn't find the requested data. This usually means Paddle Billing isn't enabled for your account, or your API key is for a different environment (sandbox vs. production). Check your Paddle account and reconnect with a matching API key.",
}
def should_retry_non_retryable_errors(self) -> bool:
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/tests/test_paddle.py b/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/tests/test_paddle.py
index 6cf8a06da48e..45b320bfdabb 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/tests/test_paddle.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/paddle/tests/test_paddle.py
@@ -1,11 +1,14 @@
from typing import cast
+import pytest
+
from requests.adapters import HTTPAdapter
from products.warehouse_sources.backend.temporal.data_imports.sources.paddle.paddle import (
PADDLE_BASE_URL,
_get_paddle_session,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.paddle.source import PaddleSource
class TestPaddleSession:
@@ -29,3 +32,33 @@ class TestPaddleSession:
assert retry.is_retry("GET", 401) is False
assert retry.is_retry("GET", 403) is False
assert retry.is_retry("GET", 400) is False
+
+
+class TestPaddleNonRetryableErrors:
+ @pytest.mark.parametrize(
+ "observed_error",
+ [
+ # A 404 on a list endpoint we know exists means the resource isn't reachable for this
+ # account (Billing not enabled, or a wrong-environment key) — retrying can't fix it.
+ "404 Client Error: Not Found for url: https://api.paddle.com/subscriptions?per_page=200&order_by=id%5BASC%5D",
+ "400 Client Error: Bad Request for url: https://api.paddle.com/transactions?per_page=200",
+ "401 Client Error: Unauthorized for url: https://api.paddle.com/customers",
+ "403 Client Error: Forbidden for url: https://api.paddle.com/products",
+ ],
+ )
+ def test_non_retryable_errors_match_client_failures(self, observed_error):
+ non_retryable_errors = PaddleSource().get_non_retryable_errors()
+ assert any(key in observed_error for key in non_retryable_errors)
+
+ @pytest.mark.parametrize(
+ "other_error",
+ [
+ # Transient/infra errors must stay retryable.
+ "HTTPSConnectionPool(host='api.paddle.com', port=443): Read timed out.",
+ "500 Server Error: Internal Server Error for url: https://api.paddle.com/subscriptions",
+ "Connection reset by peer",
+ ],
+ )
+ def test_non_retryable_errors_do_not_match_transient(self, other_error):
+ non_retryable_errors = PaddleSource().get_non_retryable_errors()
+ assert not any(key in other_error for key in non_retryable_errors)