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(mollie): treat 400 Bad Request as non-retryable (#67556)

Tom Owers581ba65bbd37
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/source.py
index 407b4e25a162..8fed364ca56d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/source.py
@@ -42,6 +42,11 @@ class MollieSource(ResumableSource[MollieSourceConfig, MollieResumeConfig]):
return {
"401 Client Error: Unauthorized for url: https://api.mollie.com": "Mollie authentication failed. Please check your API key.",
"403 Client Error: Forbidden for url: https://api.mollie.com": "Mollie denied access. Please check that your API key has access to this data.",
+ # Mollie rejects profile-scoped list endpoints with a 400 when the credential is an
+ # organization/OAuth access token, which needs an explicit profile a regular API key
+ # supplies implicitly. The request shape is fixed, so retrying replays the same failure.
+ # The match is any Mollie 400, so the message leads with the common cause but hedges.
+ "400 Client Error: Bad Request for url: https://api.mollie.com": "Mollie rejected the request as a Bad Request (400). The most common cause is connecting an organization or OAuth access token, which needs a specific profile that a regular API key supplies implicitly — reconnect with a regular Mollie API key (starts with `live_` or `test_`). If you are already using a regular API key, contact support so we can investigate.",
}
@property
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/tests/test_mollie_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/tests/test_mollie_source.py
index 4e467f0dab52..e4dd6d4b83c8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/tests/test_mollie_source.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mollie/tests/test_mollie_source.py
@@ -44,9 +44,11 @@ class TestMollieSource:
[
"401 Client Error: Unauthorized for url: https://api.mollie.com/v2/payments?limit=250",
"403 Client Error: Forbidden for url: https://api.mollie.com/v2/settlements",
+ "400 Client Error: Bad Request for url: https://api.mollie.com/v2/subscriptions?limit=250",
+ "400 Client Error: Bad Request for url: https://api.mollie.com/v2/chargebacks?limit=250",
],
)
- def test_non_retryable_errors_match_auth_failures(self, observed_error):
+ def test_non_retryable_errors_match_client_errors(self, observed_error):
non_retryable_errors = self.source.get_non_retryable_errors()
assert any(key in observed_error for key in non_retryable_errors)