Jump to solution
Verify

The Fix

pip install pydantic==2.11.4

Based on closed pydantic/pydantic issue #11765 · 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
@@ -194,7 +194,7 @@ class Model(BaseModel): #> my_field='foo' - m = Model(my_alias='foo') # (3)! + m = Model(my_field='foo') # (3)! print(m)
repro.py
pydantic version: 2.11.3 pydantic-core version: 2.33.1 pydantic-core build: profile=release pgo=false install path: /home/vscode/.cache/pyuv/.venv/lib/python3.13/site-packages/pydantic python version: 3.13.3 (main, Apr 9 2025, 04:03:52) [Clang 20.1.0 ] platform: Linux-6.8.0-57-generic-x86_64-with-glibc2.36 related packages: pydantic-extra-types-2.10.3 fastapi-0.115.12 pydantic-settings-2.8.1 mypy-1.15.0 typing_extensions-4.13.2 commit: unknown
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.11.4\nWhen NOT to use: This fix should not be used if the documentation is already correct.\n\n

Why This Fix Works in Production

  • Trigger: Documentation error: Incorrect example in `populate_by_name` docstring
  • Mechanism: The documentation example for `populate_by_name` incorrectly repeated the previous example instead of showing the correct field
  • Why the fix works: Fixes the example in the `populate_by_name` documentation, correcting the third example to use `my_field` instead of `my_alias`. (first fixed release: 2.11.4).
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

  • Shows up under Python 3.13 in real deployments (not just unit tests).
  • The documentation example for `populate_by_name` incorrectly repeated the previous example instead of showing the correct field
  • Production symptom (often without a traceback): Documentation error: Incorrect example in `populate_by_name` docstring

Proof / Evidence

Discussion

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

“### Initial Checks - [x] I confirm that I'm using Pydantic V2 ### Description In the docstring for the populate_by_name configuration setting in pydantic/config.py (lines 168-205), there is an error in the code example that demonstrates the”
Issue thread · issue description · source

Failure Signature (Search String)

  • Documentation error: Incorrect example in `populate_by_name` docstring
Copy-friendly signature
signature.txt
Failure Signature ----------------- Documentation error: Incorrect example in `populate_by_name` docstring

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Documentation error: Incorrect example in `populate_by_name` docstring

Minimal Reproduction

repro.py
pydantic version: 2.11.3 pydantic-core version: 2.33.1 pydantic-core build: profile=release pgo=false install path: /home/vscode/.cache/pyuv/.venv/lib/python3.13/site-packages/pydantic python version: 3.13.3 (main, Apr 9 2025, 04:03:52) [Clang 20.1.0 ] platform: Linux-6.8.0-57-generic-x86_64-with-glibc2.36 related packages: pydantic-extra-types-2.10.3 fastapi-0.115.12 pydantic-settings-2.8.1 mypy-1.15.0 typing_extensions-4.13.2 commit: unknown

Environment

  • Python: 3.13
  • Pydantic: 2

What Broke

Users were misled by incorrect documentation, potentially causing confusion in implementation.

Why It Broke

The documentation example for `populate_by_name` incorrectly repeated the previous example instead of showing the correct field

Fix Options (Details)

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

pip install pydantic==2.11.4

When NOT to use: This fix should not be used if the documentation is already correct.

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

First fixed release: 2.11.4

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 documentation is already correct.

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

Related Issues

No related fixes found.

Sources

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