Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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
repro.py
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'}
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
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).
Production impact:
  • 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

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.”
@jderuiter · 2024-10-10 · confirmation · source
“Hi @jderuiter, Thanks for your question. Looks like this changed in https://github.com/pydantic/pydantic/pull/10112. Looking into a fix now.”
@sydney-runkle · 2024-10-10 · source
“> Hi @jderuiter, > > Thanks for your question. Looks like this changed in #10112. Looking into a fix now. Thanks a lot!”
@jderuiter · 2024-10-10 · source
“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…”
@sydney-runkle · 2024-10-10 · source

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
signature.txt
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.txt
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

repro.py
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

When NOT to use: Do not use this fix if you require string representation for IP addresses.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if you require string representation for IP addresses.

Verify Fix

verify
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

VersionStatus
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.