Jump to solution
Details

The Fix

pip install stripe==14.4.0a2

Based on closed stripe/stripe-python issue #99 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Open PR/Commit
@@ -117,6 +117,12 @@ def __getattr__(self, k): raise AttributeError(*err.args) + def __delattr__(self, k): + if k[0] == '_' or k in self.__dict__: + return super(StripeObject, self).__delattr__(k)
fix.md
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: This fix should not be used if the API behavior changes are unacceptable.\n\n

Why This Fix Works in Production

  • Trigger: InvalidRequestError: No such coupon: invalid
  • Mechanism: The API does not allow unsetting an invalid coupon directly via the customer object
  • Why the fix works: Allows attributes to be deleted from Stripe objects, fixing the issue where an invalid coupon could not be unset. (first fixed release: 14.4.0a2).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • The API does not allow unsetting an invalid coupon directly via the customer object
  • Surfaces as: InvalidRequestError: No such coupon: invalid

Proof / Evidence

  • GitHub issue: #99
  • Fix PR: https://github.com/stripe/stripe-python/pull/181
  • First fixed release: 14.4.0a2
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-08
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.64

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@danielchatfield is correct. Setting the coupon to None or "" will not unset the coupon. You'll need to use the delete_discount method.”
@kyleconroy · 2014-08-11 · source
“@kyleconroy the issue here is that the coupon was not valid and thus was not saved on the stripe servers. delete_discount fails here. This is…”
@danielchatfield · 2014-08-11 · source
“Whoops, thanks @danielchatfield. I misread the beginning of the issue. Yes, this is a valid bug, as it shouldn't be possible to get a customer…”
@kyleconroy · 2014-08-11 · source
“I haven't tested it, but does delattr work? https://docs.python.org/2/c-api/object.html#c.PyObject_DelAttr”
@robbyt · 2014-08-11 · source

Failure Signature (Search String)

  • InvalidRequestError: No such coupon: invalid

Error Message

Stack trace
error.txt
Error Message ------------- InvalidRequestError: No such coupon: invalid
Stack trace
error.txt
Error Message ------------- InvalidRequestError: You passed an empty string for 'coupon'. We assume empty values are an attempt to unset a parameter; however 'coupon' cannot be unset. You should remove 'coupon' from your request or supply a non-empty value

What Broke

Customers could not be saved due to invalid coupon states, causing operational disruptions.

Why It Broke

The API does not allow unsetting an invalid coupon directly via the customer object

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install stripe==14.4.0a2

When NOT to use: This fix should not be used if the API behavior changes are unacceptable.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/stripe/stripe-python/pull/181

First fixed release: 14.4.0a2

Last verified: 2026-02-08. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix should not be used if the API behavior changes are unacceptable.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
14.4.0a2 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.