Jump to solution
Details

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.

Open PR/Commit
@@ -46,6 +46,7 @@ MultiHostUrl, PydanticCustomError, + PydanticSerializationUnexpectedValue, PydanticUndefined, Url,
fix.md
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

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…”
@sydney-runkle · 2024-06-25 · confirmation · source
“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…”
@sydney-runkle · 2024-08-12 · confirmation · source
“In order to address cases like #9590, we're going to need to add some sort of slow isinstance check”
@sydney-runkle · 2024-08-20 · confirmation · source
“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…”
@davidhewitt · 2024-06-19 · source

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

When NOT to use: Do not use this fix if union serialization behavior is expected to change significantly.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

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

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