The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #9688 · 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.
@@ -46,6 +46,7 @@
MultiHostUrl,
PydanticCustomError,
+ PydanticSerializationUnexpectedValue,
PydanticUndefined,
Url,
Option A — Upgrade to fixed release\npip install pydantic==1.10.18\nWhen NOT to use: Do not use this fix if union serialization behavior is expected to change significantly.\n\n
Why This Fix Works in Production
- Trigger: 4. Support serialization discriminators, both of `str` type and of `callable` type. Off the top of my head I can't think of a case where the `str` type…
- Mechanism: The IP schema serialization logic was not handling union types correctly
- Why the fix works: Fixes the IP schema serialization logic, addressing issues related to union serialization behavior. (first fixed release: 1.10.18).
Why This Breaks in Prod
- The IP schema serialization logic was not handling union types correctly
- Production symptom (often without a traceback): 4. Support serialization discriminators, both of `str` type and of `callable` type. Off the top of my head I can't think of a case where the `str` type discriminator would be different for serialization vs validation, but whatever.
Proof / Evidence
- GitHub issue: #9688
- Fix PR: https://github.com/pydantic/pydantic/pull/10112
- First fixed release: 1.10.18
- 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.76
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Upon further reflection, I think just the combo of 1 and 4 will be a major improvement, and we can mark this issue as resolved…”
“Though I think we could leave this issue open after the above PRs are merged in order to address cases like #9590, I'm satisfied with…”
“In order to address cases like #9590, we're going to need to add some sort of slow isinstance check”
“I think (4) will be a more reliable (but slightly less performant) second step than 2 because it sidesteps the question of where to store…”
Failure Signature (Search String)
- 4. Support serialization discriminators, both of `str` type and of `callable` type. Off the top of my head I can't think of a case where the `str` type discriminator would be
Copy-friendly signature
Failure Signature
-----------------
4. Support serialization discriminators, both of `str` type and of `callable` type. Off the top of my head I can't think of a case where the `str` type discriminator would be different for serialization vs validation, but whatever.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
4. Support serialization discriminators, both of `str` type and of `callable` type. Off the top of my head I can't think of a case where the `str` type discriminator would be different for serialization vs validation, but whatever.
What Broke
Union serialization failures led to incorrect data being serialized, causing application errors.
Why It Broke
The IP schema serialization logic was not handling union types correctly
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.18
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/10112
First fixed release: 1.10.18
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if union serialization behavior is expected to change significantly.
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.18 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.