The Fix
Upgrade to version 0.14.0 or later.
Based on closed encode/httpx issue #1023 · 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%.
@@ -25,6 +25,7 @@
StreamConsumed,
StreamError,
+ TimeoutException,
TooManyRedirects,
WriteError,
import httpx
try:
httpx.get('http://localhost')
except httpx.HTTPError:
print('There was an httpx error')
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.0 or later.\nWhen NOT to use: This fix is not suitable if you rely on specific httpcore exceptions for error handling.\n\n
Why This Fix Works in Production
- Trigger: 0.13: some `httpcore` exceptions are missing from top level package
- Mechanism: Maps HTTPCore exceptions to HTTPX-specific exceptions, ensuring that catching HTTPError will catch any exception raised by HTTPX.
- Why the fix works: Maps HTTPCore exceptions to HTTPX-specific exceptions, ensuring that catching HTTPError will catch any exception raised by HTTPX. (first fixed release: 0.14.0).
- 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
- Production symptom (often without a traceback): 0.13: some `httpcore` exceptions are missing from top level package
Proof / Evidence
- GitHub issue: #1023
- Fix PR: https://github.com/encode/httpx/pull/1044
- First fixed release: 0.14.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.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Yeah, to be honest we hadn't realized the exception handling API would change so much due to the deferring of the networking layer to httpcore,…”
“If only we were paid for fixing all of the "small" changes we make 😄 . Is most of the discussion happening in the gitter…”
“@iwoloschin I'm tempted to keep the base class issue to #949”
“I made this as a separate issue because I couldn't really find any big, obvious notes that exception handling had changed for 0.13”
Failure Signature (Search String)
- 0.13: some `httpcore` exceptions are missing from top level package
- Even if users should be using more specific exceptions having a single base exception is an incredibly useful feature for any library and it'd be great if we could ensure this
Copy-friendly signature
Failure Signature
-----------------
0.13: some `httpcore` exceptions are missing from top level package
Even if users should be using more specific exceptions having a single base exception is an incredibly useful feature for any library and it'd be great if we could ensure this behavior is set for the upcoming 1.0 release.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
0.13: some `httpcore` exceptions are missing from top level package
Even if users should be using more specific exceptions having a single base exception is an incredibly useful feature for any library and it'd be great if we could ensure this behavior is set for the upcoming 1.0 release.
Minimal Reproduction
import httpx
try:
httpx.get('http://localhost')
except httpx.HTTPError:
print('There was an httpx error')
Environment
- httpx: 0.12
What Broke
Exception handling fails as HTTPError does not catch httpcore exceptions, leading to unhandled errors.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.14.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/1044
First fixed release: 0.14.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not suitable if you rely on specific httpcore exceptions for error handling.
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.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.