The Fix
Upgrade to version 0.13.0 or later.
Based on closed encode/httpx issue #349 · PR/commit linked
Production note: Watch p95/p99 latency and retry volume; timeouts can turn into retry storms and duplicate side-effects.
@@ -5,6 +5,7 @@
from ..config import Timeout
from ..exceptions import ConnectTimeout, ReadTimeout, WriteTimeout
+from ..utils import as_network_error
from .base import BaseLock, BaseSemaphore, BaseSocketStream, ConcurrencyBackend
Option A — Upgrade to fixed release\nUpgrade to version 0.13.0 or later.\nWhen NOT to use: This fix is not suitable if you require the original built-in exceptions for error handling.\n\n
Why This Fix Works in Production
- Trigger: [Feature Request]: raise httpx exception instead of buildin ConnectionResetError and ConnectionError
- Mechanism: HTTPX does not wrap built-in connection exceptions, leading to less specific error handling
- Why the fix works: Wrap network errors as HTTPX-specific exceptions to improve error handling. (first fixed release: 0.13.0).
- If left unfixed, tail latency can spike under load and surface as timeouts/retries (amplifying incident impact).
Why This Breaks in Prod
- HTTPX does not wrap built-in connection exceptions, leading to less specific error handling
- Surfaces as: [Feature Request]: raise httpx exception instead of buildin ConnectionResetError and ConnectionError
Proof / Evidence
- GitHub issue: #349
- Fix PR: https://github.com/encode/httpx/pull/707
- First fixed release: 0.13.0
- 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.78
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hi @Trim21, I think we're going to need a bit more context to address this issue. :-) - What were you trying to do? -…”
“@florimondmanca Sorry, I submit this issue by accident and I'm still writting details.”
“@florimondmanca thanks for your explanation”
“Thanks for updating the description. :) I'm not entirely sure on this myself, I'll ping @tomchristie on this one.”
Failure Signature (Search String)
- [Feature Request]: raise httpx exception instead of buildin ConnectionResetError and ConnectionError
Error Message
Stack trace
Error Message
-------------
[Feature Request]: raise httpx exception instead of buildin ConnectionResetError and ConnectionError
What Broke
Users experience unhandled exceptions instead of HTTPX-specific exceptions during network errors.
Why It Broke
HTTPX does not wrap built-in connection exceptions, leading to less specific error handling
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.13.0 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/707
First fixed release: 0.13.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if you require the original built-in exceptions for error handling.
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.
- Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
- Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.
Version Compatibility Table
| Version | Status |
|---|---|
| 0.13.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.