Jump to solution
Verify

The Fix

pip install urllib3==1.26.11

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

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@ +Added support for configuring header merging behavior with HTTPHeaderDict + +When using a ``HTTPHeaderDict`` to provide headers for a request, by default duplicate
repro.py
header_dict = HTTPHeaderDict() header_dict.add("Header", "1") header_dict.add("Header", "2") headers = dict(header_dict.itermerged()) {"Header": "1, 2"}
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 urllib3==1.26.11\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: Is it something you currently cannot do?
  • Mechanism: The implementation of request_encode_body incorrectly forces headers to be a plain dictionary
  • Why the fix works: Adds support for configuring header merging behavior with HTTPHeaderDict, allowing duplicate header values to be merged into a comma-separated list when 'combine=True' is used. (first fixed release: 1.26.11).
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

  • The implementation of request_encode_body incorrectly forces headers to be a plain dictionary
  • Production symptom (often without a traceback): Is it something you currently cannot do?

Proof / Evidence

  • GitHub issue: #2242
  • Fix PR: https://github.com/urllib3/urllib3/pull/2669
  • First fixed release: 1.26.11
  • 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.71

Discussion

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

“Haha, ended up going down a rabbit hole on this one trying to find an interface that suits the more complicated cases that Dict and…”
@haikuginger · 2022-01-31 · confirmation · source
“So HTTPHeaderDict for requests is an interesting one, because it makes total sense to use but it really wasn't meant to be a public API…”
@sethmlarson · 2021-05-22 · confirmation · source
“Going to use this issue as it contains all the discussion, I'll rename and add to the v2 milestone.”
@sethmlarson · 2021-05-23 · source
“+1, I believe this used to be a feature we supported at one point! Specifically, you could pass in a list of tuples which dict.update(...)…”
@shazow · 2021-05-22 · source

Failure Signature (Search String)

  • Is it something you currently cannot do?
  • It is nearly supported. It is broken for requests with request body because of the implementation of `request_encode_body`:
Copy-friendly signature
signature.txt
Failure Signature ----------------- Is it something you currently cannot do? It is nearly supported. It is broken for requests with request body because of the implementation of `request_encode_body`:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Is it something you currently cannot do? It is nearly supported. It is broken for requests with request body because of the implementation of `request_encode_body`:

Minimal Reproduction

repro.py
header_dict = HTTPHeaderDict() header_dict.add("Header", "1") header_dict.add("Header", "2") headers = dict(header_dict.itermerged()) {"Header": "1, 2"}

What Broke

Requests with repeated headers do not function correctly, leading to potential data loss in header information.

Why It Broke

The implementation of request_encode_body incorrectly forces headers to be a plain dictionary

Fix Options (Details)

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

pip install urllib3==1.26.11

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

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

First fixed release: 1.26.11

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

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

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 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.

Version Compatibility Table

VersionStatus
1.26.11 Fixed

Related Issues

No related fixes found.

Sources

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