Jump to solution
Details

The Fix

pip install urllib3==1.25.4

Based on closed urllib3/urllib3 issue #1636 · PR/commit linked

Open PR/Commit
@@ -278,5 +278,9 @@ In chronological order: * Improve handling of Retry-After header +* Chris Jerdonek <[email protected]> + * Remove a spurious TypeError from the exception chain inside + HTTPConnectionPool._make_request(), also for BaseExceptions.
fix.md
Option A — Upgrade to fixed release\npip install urllib3==1.25.4\nWhen NOT to use: This fix is not applicable if the code is not handling BaseExceptions.\n\n

Why This Fix Works in Production

  • Trigger: Spurious TypeError if BaseException occurs during getresponse()
  • Mechanism: The code only catches Exception, missing BaseException handling
  • Why the fix works: Removes a spurious TypeError from the exception chain for BaseExceptions in the HTTPConnectionPool._make_request() method. (first fixed release: 1.25.4).

Why This Breaks in Prod

  • The code only catches Exception, missing BaseException handling
  • Surfaces as: Spurious TypeError if BaseException occurs during getresponse()

Proof / Evidence

  • GitHub issue: #1636
  • Fix PR: https://github.com/urllib3/urllib3/pull/1637
  • First fixed release: 1.25.4
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.79

Discussion

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

“By the way, rather than nested try-excepts, another possible approach is simply to use the correct invocation of conn.getresponse() depending on the version of the…”
@cjerdonek · 2019-06-18 · source

Failure Signature (Search String)

  • Spurious TypeError if BaseException occurs during getresponse()

Error Message

Stack trace
error.txt
Error Message ------------- Spurious TypeError if BaseException occurs during getresponse()

What Broke

Users may see spurious TypeErrors during application termination.

Why It Broke

The code only catches Exception, missing BaseException handling

Fix Options (Details)

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

pip install urllib3==1.25.4

When NOT to use: This fix is not applicable if the code is not handling BaseExceptions.

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

Option D — Guard side-effects with OnceOnly Guardrail for side-effects

Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.

  • Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
  • Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
  • Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
onceonly.py
from onceonly import OnceOnly import os once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True) # Stable idempotency key per real side-effect. # Use a request id / job id / webhook delivery id / Stripe event id, etc. event_id = "evt_..." # replace key = f"stripe:webhook:{event_id}" res = once.check_lock(key=key, ttl=3600) if res.duplicate: return {"status": "already_processed"} # Safe to execute the side-effect exactly once. handle_event(event_id)

See OnceOnly SDK

When NOT to use: Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Fix reference: https://github.com/urllib3/urllib3/pull/1637

First fixed release: 1.25.4

Last verified: 2026-02-09. 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 code is not handling BaseExceptions.
  • Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Did This Fix Work in Your Case?

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

Prevention

  • Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
  • Upgrade behind a canary and run integration tests against the canary before 100% rollout.
  • Track RSS + object counts after deployments; alert on monotonic growth and GC pressure.
  • Add a long-running test that repeats the failing call path and asserts stable memory.

Version Compatibility Table

VersionStatus
1.25.4 Fixed

Related Issues

No related fixes found.

Sources

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