Jump to solution
Verify

The Fix

pip install stripe==14.4.0a2

Based on closed stripe/stripe-python issue #1114 · 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%.

Jump to Verify Open PR/Commit
@@ -1,8 +1,28 @@ @@ -1,8 +1,28 @@ +from typing import Optional +from typing_extensions import TYPE_CHECKING from stripe.util import merge_dicts
repro.py
import stripe def f() -> None: try: stripe.PaymentIntent.create() except stripe.error.InvalidRequestError as e: error = e.construct_error_object() assert error is not None # not relevant to this issue print(error.code)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: This fix is not applicable if the ErrorObject class is not used with type annotations.\n\n

Why This Fix Works in Production

  • Trigger: import stripe
  • Mechanism: Missing type annotations for attributes in the ErrorObject class caused mypy errors
  • Why the fix works: Added type annotations for the ErrorObject class to resolve type checking errors reported by mypy. (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

  • Missing type annotations for attributes in the ErrorObject class caused mypy errors
  • Surfaces as: import stripe

Proof / Evidence

Discussion

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

“Released in https://github.com/stripe/stripe-python/releases/tag/v7.2.0”
@richardm-stripe · 2023-10-31 · confirmation · source

Failure Signature (Search String)

  • import stripe

Error Message

Stack trace
error.txt
Error Message ------------- import stripe def f() -> None: try: stripe.PaymentIntent.create() except stripe.error.InvalidRequestError as e: error = e.construct_error_object() assert error is not None # not relevant to this issue print(error.code)

Minimal Reproduction

repro.py
import stripe def f() -> None: try: stripe.PaymentIntent.create() except stripe.error.InvalidRequestError as e: error = e.construct_error_object() assert error is not None # not relevant to this issue print(error.code)

What Broke

Type checking errors reported when using ErrorObject attributes in code.

Why It Broke

Missing type annotations for attributes in the ErrorObject class caused mypy errors

Fix Options (Details)

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

pip install stripe==14.4.0a2

When NOT to use: This fix is not applicable if the ErrorObject class is not used with type annotations.

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/1115

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 is not applicable if the ErrorObject class is not used with type annotations.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

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.