: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(stripe): stop retrying a customer-scoped invalid_request_error with no detail (#94735)
Tom Owersc167d4d87287
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/source.pyindex 98fa9ad65e88..a9128fba893a 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/source.py@@ -312,6 +312,12 @@ If automatic creation failed with a permissions error, the fix depends on how yo"Integration not found": "The linked Stripe integration no longer exists. Please reconnect your Stripe account.","Stripe access token not found": "Stripe OAuth access token is missing. Please reconnect your Stripe account.","Your Stripe OAuth connection has expired or been revoked. Please reconnect your Stripe account.": "Your Stripe OAuth connection has expired or been revoked. Please reconnect your Stripe account.",+ # Stripe's own `invalid_request_error` body with no usable detail, seen when listing a+ # specific customer's nested resources (e.g. payment methods). It is a 400-class error,+ # so retrying replays the identical request against the same customer and fails+ # identically every time. Stripe's own message isn't actionable, so surface a message+ # that points at the account rather than showing the raw string.+ "error_details_unknown": "Stripe rejected a request for one of your resources without a specific reason. Check your Stripe account for any restrictions or contact Stripe support, then try again.",}def get_retryable_errors(self) -> set[str]:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.pyindex ded7890cec4c..9c9deff420d6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/stripe/tests/test_stripe_source.py@@ -238,6 +238,10 @@ class TestStripeSource:# A publishable key was used where a secret/restricted key is required — matched on the# stable message text, ignoring the request id prefix."Request req_abc123: This API call cannot be made with a publishable API key. Please use a secret API key. You can find a list of your API keys at https://dashboard.stripe.com/account/apikeys.",+ # A 400-class InvalidRequestError with no usable Stripe-provided detail, raised when+ # listing a specific customer's nested resources — every retry replays the same request+ # against the same customer and fails identically.+ "Request req_abc123: error_details_unknown",],)def test_non_retryable_errors_match_permission_failures(self, observed_error):