Jump to solution
Verify

The Fix

pip install pydantic==2.6.2

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

Jump to Verify Open PR/Commit
@@ -574,7 +574,9 @@ def __repr_args__(self) -> ReprArgs: if s == 'serialization_alias' and self.serialization_alias == self.alias: continue - if s == 'default_factory' and self.default_factory is not None: + if s == 'default' and self.default is not PydanticUndefined: + yield 'default', self.default
repro.py
from pprint import pprint import pydantic class Foo(pydantic.BaseModel): a: str = pydantic.Field("ADEF", alias="A") b: int = pydantic.Field(..., alias="B") c: str | None = pydantic.Field(None, alias="C") pprint(Foo.model_fields)
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==2.6.2\nWhen NOT to use: This fix should not be used if the default value behavior is critical for existing model definitions.\n\n

Why This Fix Works in Production

  • Trigger: This is more a quality of live improvement than anything else. With the proposed change, it's easier to inspect model definitions at a glance (and it's also…
  • Mechanism: The __repr_args__ method in FieldInfo does not include the default value when explicitly set to None
  • Why the fix works: Fixes the issue where FieldInfo.__repr_args__ does not include the default value when it is explicitly set to None. (first fixed release: 2.6.2).

Why This Breaks in Prod

  • Shows up under Python 3.11 in real deployments (not just unit tests).
  • The __repr_args__ method in FieldInfo does not include the default value when explicitly set to None
  • Production symptom (often without a traceback): This is more a quality of live improvement than anything else. With the proposed change, it's easier to inspect model definitions at a glance (and it's also less confusing)

Proof / Evidence

Discussion

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

“@Evenfire, Thanks for pointing this out! I agree with your suggested change. Please open a PR, and I'd be happy to review :).”
@sydney-runkle · 2024-01-25 · source
“@Evenfire, This issue is quite related - https://github.com/pydantic/pydantic/issues/8634. Would you be interested in taking a stab at a fix for that one as well? Thanks…”
@sydney-runkle · 2024-01-25 · source
“@sydney-runkle I'll open a PR for this issue as soon as I have few minutes.”
@Evenfire · 2024-01-26 · source

Failure Signature (Search String)

  • This is more a quality of live improvement than anything else. With the proposed change, it's easier to inspect model definitions at a glance (and it's also less confusing)
Copy-friendly signature
signature.txt
Failure Signature ----------------- This is more a quality of live improvement than anything else. With the proposed change, it's easier to inspect model definitions at a glance (and it's also less confusing) python version: 3.11.7 (main, Jan 7 2024, 10:09:49) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- This is more a quality of live improvement than anything else. With the proposed change, it's easier to inspect model definitions at a glance (and it's also less confusing) python version: 3.11.7 (main, Jan 7 2024, 10:09:49) [Clang 15.0.0 (clang-1500.1.0.2.5)]

Minimal Reproduction

repro.py
from pprint import pprint import pydantic class Foo(pydantic.BaseModel): a: str = pydantic.Field("ADEF", alias="A") b: int = pydantic.Field(..., alias="B") c: str | None = pydantic.Field(None, alias="C") pprint(Foo.model_fields)

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

FieldInfo representation does not show default values, causing confusion during model inspection.

Why It Broke

The __repr_args__ method in FieldInfo does not include the default value when explicitly set to None

Fix Options (Details)

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

pip install pydantic==2.6.2

When NOT to use: This fix should not be used if the default value behavior is critical for existing model definitions.

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/8801

First fixed release: 2.6.2

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

  • This fix should not be used if the default value behavior is critical for existing model definitions.

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
2.6.2 Fixed

Related Issues

No related fixes found.

Sources

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