Jump to solution
Details

The Fix

pip install stripe==14.4.0a2

Based on closed stripe/stripe-python issue #533 · 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
@@ -193,8 +193,8 @@ class RequestsClient(HTTPClient): def __init__(self, timeout=80, session=None, **kwargs): super(RequestsClient, self).__init__(**kwargs) + self._session = session self._timeout = timeout - self._thread_local.session = session or requests.Session()
fix.md
Option A — Upgrade to fixed release\npip install stripe==14.4.0a2\nWhen NOT to use: Do not use this fix if your application does not utilize multi-threading.\n\n

Why This Fix Works in Production

  • Trigger: '_thread._local' object has no attribute 'session'
  • Mechanism: Session initialization in a thread-local store caused crashes in multi-threaded environments
  • Why the fix works: Fix session initialization for multi-threaded environments to prevent crashes in requests. (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

  • Shows up under Python 3.5 in real deployments (not just unit tests).
  • Session initialization in a thread-local store caused crashes in multi-threaded environments
  • Surfaces as: '_thread._local' object has no attribute 'session'

Proof / Evidence

Discussion

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

“Sorry about the trouble here and thanks for reporting. We've released a fix in 2.20.2.”
@brandur-stripe · 2019-01-30 · confirmation · source
“Hi @andreage, thanks for the report. I've managed to reproduce the issue, we should have a fix out promptly!”
@ob-stripe · 2019-01-30 · source

Failure Signature (Search String)

  • '_thread._local' object has no attribute 'session'

Error Message

Stack trace
error.txt
Error Message ------------- '_thread._local' object has no attribute 'session'

Environment

  • Python: 3.5

What Broke

Requests fail with APIConnectionError due to missing session in threads.

Why It Broke

Session initialization in a thread-local store caused crashes in multi-threaded environments

Fix Options (Details)

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

pip install stripe==14.4.0a2

When NOT to use: Do not use this fix if your application does not utilize multi-threading.

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

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

  • Do not use this fix if your application does not utilize multi-threading.

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.