The Fix
pip install stripe==14.4.0a2
Based on closed stripe/stripe-python issue #1249 · 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%.
@@ -13,7 +13,7 @@
class ErrorObject(StripeObject):
charge: Optional[str]
- code: int
+ code: Optional[str]
decline_code: Optional[str]
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: This fix is not applicable if the code relies on the previous integer type for functionality.\n\n
Why This Fix Works in Production
- Trigger: Incorrect annotation on `ErrorOrbject.code`
- Mechanism: Fixes the type annotation of `ErrorObject.code` from `int` to `Optional[str]` to match the API documentation.
- Why the fix works: Fixes the type annotation of `ErrorObject.code` from `int` to `Optional[str]` to match the API documentation. (first fixed release: 14.4.0a2).
- 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
- Shows up under Python 3.10 in real deployments (not just unit tests).
- Production symptom (often without a traceback): Incorrect annotation on `ErrorOrbject.code`
Proof / Evidence
- GitHub issue: #1249
- Fix PR: https://github.com/stripe/stripe-python/pull/1250
- 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.68
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hi @samueljsb, thanks for the bug report! I've updated the type in https://github.com/stripe/stripe-python/pull/1250, and this change will go out in next week's release.”
Failure Signature (Search String)
- Incorrect annotation on `ErrorOrbject.code`
- Hi @samueljsb, thanks for the bug report! I've updated the type in https://github.com/stripe/stripe-python/pull/1250, and this change will go out in next week's release.
Copy-friendly signature
Failure Signature
-----------------
Incorrect annotation on `ErrorOrbject.code`
Hi @samueljsb, thanks for the bug report! I've updated the type in https://github.com/stripe/stripe-python/pull/1250, and this change will go out in next week's release.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Incorrect annotation on `ErrorOrbject.code`
Hi @samueljsb, thanks for the bug report! I've updated the type in https://github.com/stripe/stripe-python/pull/1250, and this change will go out in next week's release.
Environment
- Python: 3.10
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install stripe==14.4.0a2
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/1250
First fixed release: 14.4.0a2
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if the code relies on the previous integer type for functionality.
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
| Version | Status |
|---|---|
| 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.