Jump to solution
Details

The Fix

pip install pydantic==1.10.15

Based on closed pydantic/pydantic issue #8990 · PR/commit linked

Open PR/Commit
@@ -224,6 +224,9 @@ print(Model(x='test value').model_dump_json()) ``` +!!! note + A single serializer can also be called on all fields by passing the special value '*' to the [`@field_serializer`][pydantic.functional_serializers.field_serializer] decorator. +
fix.md
Option A — Upgrade to fixed release\npip install pydantic==1.10.15\nWhen NOT to use: Do not use this fix if you require different serialization logic for individual fields.\n\n

Why This Fix Works in Production

  • Trigger: this is a 2-lines change, i can submit a PR right away if this is indeed a missing feature.
  • Mechanism: The absence of a field_serializer('*') feature limits serialization flexibility in Pydantic models
  • Why the fix works: Allows the use of field_serializer('*') for defining a serializer for all fields in a model, addressing issue #8990. (first fixed release: 1.10.15).

Why This Breaks in Prod

  • The absence of a field_serializer('*') feature limits serialization flexibility in Pydantic models
  • Production symptom (often without a traceback): this is a 2-lines change, i can submit a PR right away if this is indeed a missing feature.

Proof / Evidence

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“@ornariece, This seems reasonable to me! Thanks for pointing this out! Feel free to submit a PR + ping me when you need a review…”
@sydney-runkle · 2024-03-12 · source

Failure Signature (Search String)

  • this is a 2-lines change, i can submit a PR right away if this is indeed a missing feature.
Copy-friendly signature
signature.txt
Failure Signature ----------------- this is a 2-lines change, i can submit a PR right away if this is indeed a missing feature.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- this is a 2-lines change, i can submit a PR right away if this is indeed a missing feature.

Environment

  • Pydantic: 2

What Broke

Developers cannot define a serializer for all fields, leading to repetitive code.

Why It Broke

The absence of a field_serializer('*') feature limits serialization flexibility in Pydantic models

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==1.10.15

When NOT to use: Do not use this fix if you require different serialization logic for individual fields.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option D — Guard side-effects with OnceOnly Guardrail for side-effects

Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.

  • Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
  • Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
  • Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
onceonly.py
from onceonly import OnceOnly import os once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True) # Stable idempotency key per real side-effect. # Use a request id / job id / webhook delivery id / Stripe event id, etc. event_id = "evt_..." # replace key = f"stripe:webhook:{event_id}" res = once.check_lock(key=key, ttl=3600) if res.duplicate: return {"status": "already_processed"} # Safe to execute the side-effect exactly once. handle_event(event_id)

See OnceOnly SDK

When NOT to use: Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Fix reference: https://github.com/pydantic/pydantic/pull/9001

First fixed release: 1.10.15

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 different serialization logic for individual fields.
  • Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

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.15 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.