The Fix
pip install pydantic==1.10.19
Based on closed pydantic/pydantic issue #10589 · 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%.
@@ -486,9 +486,9 @@ def get_json_schema_no_cases(_, handler: GetJsonSchemaHandler) -> JsonSchemaValu
def _ip_schema(self, tp: Any) -> CoreSchema:
- from ._validators import IP_VALIDATOR_LOOKUP
+ from ._validators import IP_VALIDATOR_LOOKUP, IpType
import ipaddress
from pydantic import BaseModel
class Address(BaseModel):
ip: ipaddress.IPv4Address
a = Address(ip="127.0.0.1")
print(a.model_dump())
# 2.8.2: {'ip': IPv4Address('127.0.0.1')}
# 2.9.2: {'ip': '127.0.0.1'}
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==1.10.19\nWhen NOT to use: Do not use this fix if you require string representation for IP addresses.\n\n
Why This Fix Works in Production
- Trigger: model_dump() does not include Python object for IP addresses
- Mechanism: The model_dump() method changed to serialize IP addresses as strings instead of Python objects
- Why the fix works: Fix serialization for IP types with `mode='python'` to include the Python object instead of the string representation. (first fixed release: 1.10.19).
- 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 model_dump() method changed to serialize IP addresses as strings instead of Python objects
- Production symptom (often without a traceback): model_dump() does not include Python object for IP addresses
Proof / Evidence
- GitHub issue: #10589
- Fix PR: https://github.com/pydantic/pydantic/pull/10594
- First fixed release: 1.10.19
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.62
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“There is no rush for me, so whatever works best for you. I'll just stick with v2.8.2 until the fix is released.”
“Hi @jderuiter, Thanks for your question. Looks like this changed in https://github.com/pydantic/pydantic/pull/10112. Looking into a fix now.”
“> Hi @jderuiter, > > Thanks for your question. Looks like this changed in #10112. Looking into a fix now. Thanks a lot!”
“We can probably do a patch release with this fix (v2.9.3), or if you're in no rush, we could wait until v2.10, which we'll do…”
Failure Signature (Search String)
- model_dump() does not include Python object for IP addresses
- Since version 2.9.0, model_dump() does not seem to include a Python object for IP addresses anymore but instead includes the string representation.
Copy-friendly signature
Failure Signature
-----------------
model_dump() does not include Python object for IP addresses
Since version 2.9.0, model_dump() does not seem to include a Python object for IP addresses anymore but instead includes the string representation.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
model_dump() does not include Python object for IP addresses
Since version 2.9.0, model_dump() does not seem to include a Python object for IP addresses anymore but instead includes the string representation.
Minimal Reproduction
import ipaddress
from pydantic import BaseModel
class Address(BaseModel):
ip: ipaddress.IPv4Address
a = Address(ip="127.0.0.1")
print(a.model_dump())
# 2.8.2: {'ip': IPv4Address('127.0.0.1')}
# 2.9.2: {'ip': '127.0.0.1'}
Environment
- Pydantic: 2
What Broke
Users receive string representations of IP addresses instead of Python objects, causing compatibility issues.
Why It Broke
The model_dump() method changed to serialize IP addresses as strings instead of Python objects
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.19
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pydantic/pydantic/pull/10594
First fixed release: 1.10.19
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if you require string representation for IP addresses.
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.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.10.19 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.