The Fix
pip install urllib3==1.25
Based on closed urllib3/urllib3 issue #1165 · 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%.
@@ -7,6 +7,9 @@ dev (master)
delivery. (Pull #1154)
+* Fixed regression in 1.21 that threw exceptions when users passed the
+ ``socket_options`` flag to the ``PoolManager``. (Issue #1165)
+
2017-04-28T04:26:10.152544966Z File "/usr/local/lib/python3.5/site-packages/steembase/http_client.py", line 146, in exec
2017-04-28T04:26:10.152552486Z response = self.request(body=body)
2017-04-28T04:26:10.152560726Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 303, in urlopen
2017-04-28T04:26:10.152585508Z conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
2017-04-28T04:26:10.152592399Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 219, in connection_from_host
2017-04-28T04:26:10.152599135Z return self.connection_from_context(request_context)
2017-04-28T04:26:10.152604508Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 232, in connection_from_context
2017-04-28T04:26:10.152610299Z return self.connection_from_pool_key(pool_key, request_context=request_context)
2017-04-28T04:26:10.152615790Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 245, in connection_from_pool_key
2017-04-28T04:26:10.152621674Z pool = self.pools.get(pool_key)
2017-04-28T04:26:10.152626932Z File "/usr/local/lib/python3.5/_collections_abc.py", line 597, in get
2017-04-28T04:26:10.152632427Z return self[key]
2017-04-28T04:26:10.152637611Z File "/usr/local/lib/python3.5/site-packages/urllib3/_collections.py", line 53, in __getitem__
2017-04-28T04:26:10.152643188Z item = self._container.pop(key)
2017-04-28T04:26:10.152648363Z TypeError: unhashable type: 'list'
from urllib3.poolmanager import PoolManager
p = PoolManager(socket_options=[])
p.urlopen('GET', 'https://www.google.com')
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: Do not use this fix if socket_options is intended to be a list for other functionalities.\n\n
Why This Fix Works in Production
- Trigger: TypeError: unhashable type: 'list'
- Mechanism: The socket_options parameter was incorrectly passed as a list instead of a tuple, causing a TypeError
- Why the fix works: Fixed a regression in urllib3 version 1.21 that caused exceptions when passing the socket_options flag to the PoolManager. (first fixed release: 1.25).
- 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).
- The socket_options parameter was incorrectly passed as a list instead of a tuple, causing a TypeError
- Surfaces as: TypeError: unhashable type: 'list'
Proof / Evidence
- GitHub issue: #1165
- Fix PR: https://github.com/urllib3/urllib3/pull/1166
- First fixed release: 1.25
- 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.42
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Thanks for the report. Could you provide a minimal reproducible example? You link to code but there's no mention of how you're using the code…”
“Yeah that's it, here's a minimal verifiable example for maintainers that read this tomorrow: cc: #1016 @jeremycline Goodnight :sleeping:”
“Any attempt to do a http request will do. A simple example: Steem in this case wraps http_client.py (code link above). My speculation is that…”
“Looks like it's socket_options that needs to be converted into a tuple to be used as a part of a PoolKey because lists aren't hash-able?…”
Failure Signature (Search String)
- TypeError: unhashable type: 'list'
Error Message
Stack trace
Error Message
-------------
TypeError: unhashable type: 'list'
Minimal Reproduction
2017-04-28T04:26:10.152544966Z File "/usr/local/lib/python3.5/site-packages/steembase/http_client.py", line 146, in exec
2017-04-28T04:26:10.152552486Z response = self.request(body=body)
2017-04-28T04:26:10.152560726Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 303, in urlopen
2017-04-28T04:26:10.152585508Z conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
2017-04-28T04:26:10.152592399Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 219, in connection_from_host
2017-04-28T04:26:10.152599135Z return self.connection_from_context(request_context)
2017-04-28T04:26:10.152604508Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 232, in connection_from_context
2017-04-28T04:26:10.152610299Z return self.connection_from_pool_key(pool_key, request_context=request_context)
2017-04-28T04:26:10.152615790Z File "/usr/local/lib/python3.5/site-packages/urllib3/poolmanager.py", line 245, in connection_from_pool_key
2017-04-28T04:26:10.152621674Z pool = self.pools.get(pool_key)
2017-04-28T04:26:10.152626932Z File "/usr/local/lib/python3.5/_collections_abc.py", line 597, in get
2017-04-28T04:26:10.152632427Z return self[key]
2017-04-28T04:26:10.152637611Z File "/usr/local/lib/python3.5/site-packages/urllib3/_collections.py", line 53, in __getitem__
2017-04-28T04:26:10.152643188Z item = self._container.pop(key)
2017-04-28T04:26:10.152648363Z TypeError: unhashable type: 'list'
Environment
- Python: 3.5
- urllib3: 1.21
What Broke
HTTP requests fail with a TypeError when socket_options is a list.
Why It Broke
The socket_options parameter was incorrectly passed as a list instead of a tuple, causing a TypeError
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install urllib3==1.25
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/1166
First fixed release: 1.25
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if socket_options is intended to be a list for other functionalities.
Verify Fix
from urllib3.poolmanager import PoolManager
p = PoolManager(socket_options=[])
p.urlopen('GET', 'https://www.google.com')
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
| Version | Status |
|---|---|
| 1.25 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.