The Fix
Upgrade to version 0.14.1 or later.
Based on closed encode/httpx issue #1151 · 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.
@@ -1196,6 +1196,9 @@ def __init__(self, response: Response):
def info(self) -> email.message.Message:
info = email.message.Message()
- for key, value in self.response.headers.items():
+ for key, value in self.response.headers.multi_items():
+ # Note that setting `info[key]` here is an "append" operation,
import os
from http.cookiejar import LWPCookieJar
import httpx
h = httpx.Client(cookies=LWPCookieJar('test'))
if os.path.isfile('test'):
h.cookies.jar.load()
h.get('https://www.google.ru')
h.cookies.jar.save()
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.14.1 or later.\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: AttributeError: 'NoneType' object has no attribute 'startswith'**
- Mechanism: The cookie ingestion process fails due to a NoneType domain value in the response headers
- Why the fix works: Fix behaviour with multiple Set-Cookie headers, resolving an issue with cookie ingestion in version 0.14.0. (first fixed release: 0.14.1).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- Shows up under Python 3.7 in real deployments (not just unit tests).
- The cookie ingestion process fails due to a NoneType domain value in the response headers
- Surfaces as: AttributeError: 'NoneType' object has no attribute 'startswith'**
Proof / Evidence
- GitHub issue: #1151
- Fix PR: https://github.com/encode/httpx/pull/1156
- First fixed release: 0.14.1
- 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.54
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Now resolved in 0.14.1. Thanks for raising this!”
“Heya, first things..”
“Yeah, something's weird”
“Doesn't seem to come from httpcore (tested against 0.9.1 with a bit of patching for the API changes…), and the git blame on Cookies shows…”
Failure Signature (Search String)
- AttributeError: 'NoneType' object has no attribute 'startswith'**
Error Message
Stack trace
Error Message
-------------
AttributeError: 'NoneType' object has no attribute 'startswith'**
Stack trace
Error Message
-------------
Traceback (most recent call last):\n File "/usr/lib/python3.7/http/cookiejar.py", line 1947, in _really_load\n domain_specified = domain.startswith(".")
Stack trace
Error Message
-------------
Traceback (most recent call last):\n File "test.py", line 7, in <module>\n h.cookies.jar.load()\n File "/usr/lib/python3.7/http/cookiejar.py", line 1794, in load\n self._really_load(f, filename, ignore_discard, ignore_expires)\n File "/usr/lib/python3.7/http/cookiejar.py", line 1968, in _really_load\n (filename, line))
Minimal Reproduction
import os
from http.cookiejar import LWPCookieJar
import httpx
h = httpx.Client(cookies=LWPCookieJar('test'))
if os.path.isfile('test'):
h.cookies.jar.load()
h.get('https://www.google.ru')
h.cookies.jar.save()
Environment
- Python: 3.7
- httpx: 0.13.3
What Broke
Users experience AttributeError when loading cookies, leading to failed requests.
Why It Broke
The cookie ingestion process fails due to a NoneType domain value in the response headers
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.14.1 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/httpx/pull/1156
First fixed release: 0.14.1
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Verify Fix
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.
- 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
| Version | Status |
|---|---|
| 0.14.1 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.