Jump to solution
Verify

The Fix

pip install requests==2.32.0

Based on closed psf/requests issue #6533 · 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
@@ -1026,8 +1026,30 @@ library to use SSLv3:: block=block, ssl_version=ssl.PROTOCOL_SSLv3) +Example: Automatic Retries +^^^^^^^^^^^^^^^^^^^^^^^^^^ +
repro.py
from requests import Session from requests.adapters import HTTPAdapter from requests.exceptions import RetryError from urllib3.util import Retry ​ ​ class LogRetry(Retry): def __init__(self, *args, **kwargs): total_retries = kwargs["total"] print(f"Retry {total_retries} initiating...") super().__init__(*args, **kwargs) ​ ​ def test_case(retry_clazz, prefix): s = Session() s.mount( prefix, HTTPAdapter( max_retries=retry_clazz( total=3, backoff_factor=0.1, status_forcelist=[500], allowed_methods={"POST"}, ) ), ) try: print(f"Trying with retry class {retry_clazz}, prefix: {prefix}") s.post("https://httpbin.org/status/500", {}) except RetryError: print("Got the retry error, hooray!") else: print("Didn't get the retry error, oh no!") ​ ​ test_case(Retry, "https://") test_case(Retry, "") test_case(LogRetry, "https://") test_case(LogRetry, "")
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 requests==2.32.0\nWhen NOT to use: This fix is not applicable if the intended behavior is to allow empty prefix adapters.\n\n

Why This Fix Works in Production

  • Trigger: status_forcelist=[500],
  • Mechanism: Retries are ignored when an HTTPAdapter is bound to an empty string prefix
  • Why the fix works: Added an example for implementing automatic retries in the Advanced Usage documentation of Requests. (first fixed release: 2.32.0).
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

  • Retries are ignored when an HTTPAdapter is bound to an empty string prefix
  • Production symptom (often without a traceback): from requests.exceptions import RetryError

Proof / Evidence

  • GitHub issue: #6533
  • Fix PR: https://github.com/psf/requests/pull/6258
  • First fixed release: 2.32.0
  • 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.44

Discussion

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

“We use the longest match and document that. So if you do not remove the other adapters this doesn't work and it is the intended…”
@sigmavirus24 · 2023-09-21 · source
“Ah, you must be referring to the implicit adapters defined on Session instantiation at https://github.com/psf/requests/blob/881281250f74549f560408e5546d95a8cd73ce28/src/requests/sessions.py#L448”
@matthewarmand · 2023-09-21 · source

Failure Signature (Search String)

  • status_forcelist=[500],
Copy-friendly signature
signature.txt
Failure Signature ----------------- from requests.exceptions import RetryError status_forcelist=[500],

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- from requests.exceptions import RetryError status_forcelist=[500],

Minimal Reproduction

repro.py
from requests import Session from requests.adapters import HTTPAdapter from requests.exceptions import RetryError from urllib3.util import Retry ​ ​ class LogRetry(Retry): def __init__(self, *args, **kwargs): total_retries = kwargs["total"] print(f"Retry {total_retries} initiating...") super().__init__(*args, **kwargs) ​ ​ def test_case(retry_clazz, prefix): s = Session() s.mount( prefix, HTTPAdapter( max_retries=retry_clazz( total=3, backoff_factor=0.1, status_forcelist=[500], allowed_methods={"POST"}, ) ), ) try: print(f"Trying with retry class {retry_clazz}, prefix: {prefix}") s.post("https://httpbin.org/status/500", {}) except RetryError: print("Got the retry error, hooray!") else: print("Didn't get the retry error, oh no!") ​ ​ test_case(Retry, "https://") test_case(Retry, "") test_case(LogRetry, "https://") test_case(LogRetry, "")

What Broke

Retries do not execute, leading to unhandled response errors in production.

Why It Broke

Retries are ignored when an HTTPAdapter is bound to an empty string prefix

Fix Options (Details)

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

pip install requests==2.32.0

When NOT to use: This fix is not applicable if the intended behavior is to allow empty prefix adapters.

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

Fix reference: https://github.com/psf/requests/pull/6258

First fixed release: 2.32.0

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 intended behavior is to allow empty prefix adapters.

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

  • Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
  • Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.

Version Compatibility Table

VersionStatus
2.32.0 Fixed

Related Issues

No related fixes found.

Sources

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