The Fix
pip install pydantic==2.12.3
Based on closed pydantic/pydantic issue #12413 · 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%.
@@ -394,6 +394,7 @@ Model()
* `@root_validator` has been deprecated, and should be replaced with
[`@model_validator`](api/functional_validators.md#pydantic.functional_validators.model_validator), which also provides new features and improvements.
+ Be aware that the allowed signatures have changed (see the [relevant documentation](./concepts/validators.md#model-validators)).
* Under some circumstances (such as assignment when `model_config['validate_assignment'] is True`),
the `@model_validator` decorator will receive an instance of the model, not a dict of values. You may
Here is the versioning: /opt/conda/lib/python3.12/site-packages/pydantic/_migration.py:283: UserWarning: `pydantic.utils:version_info` has been moved to `pydantic.version:version_info`.
warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')
pydantic version: 2.11.7
pydantic-core version: 2.33.2
pydantic-core build: profile=release pgo=false
python version: 3.12.9 | packaged by conda-forge | (main, Feb 14 2025, 08:00:06) [GCC 13.3.0]
platform: Linux-5.10.244-240.970.amzn2.x86_64-x86_64-with-glibc2.35
related packages: fastapi-0.116.1 pydantic-settings-2.10.1 typing_extensions-4.14.1
commit: unknown.
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==2.12.3\nWhen NOT to use: This fix is not applicable if using custom validators that require the previous signature.\n\n
Why This Fix Works in Production
- Trigger: AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'format'
- Mechanism: Raises a warning when an invalid after model validator function signature is used, reverting to the previous behavior to address issues reported in Pydantic 2.12.2.
- Why the fix works: Raises a warning when an invalid after model validator function signature is used, reverting to the previous behavior to address issues reported in Pydantic 2.12.2. (first fixed release: 2.12.3).
- 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.12 in real deployments (not just unit tests).
- Surfaces as: AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'format'
Proof / Evidence
- GitHub issue: #12413
- Fix PR: https://github.com/pydantic/pydantic/pull/12414
- First fixed release: 2.12.3
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.43
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“You are using an invalid function signature for _after_ model validators”
Failure Signature (Search String)
- AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'format'
Error Message
Stack trace
Error Message
-------------
AttributeError: 'pydantic_core._pydantic_core.ValidationInfo' object has no attribute 'format'
Minimal Reproduction
Here is the versioning: /opt/conda/lib/python3.12/site-packages/pydantic/_migration.py:283: UserWarning: `pydantic.utils:version_info` has been moved to `pydantic.version:version_info`.
warnings.warn(f'`{import_path}` has been moved to `{new_location}`.')
pydantic version: 2.11.7
pydantic-core version: 2.33.2
pydantic-core build: profile=release pgo=false
python version: 3.12.9 | packaged by conda-forge | (main, Feb 14 2025, 08:00:06) [GCC 13.3.0]
platform: Linux-5.10.244-240.970.amzn2.x86_64-x86_64-with-glibc2.35
related packages: fastapi-0.116.1 pydantic-settings-2.10.1 typing_extensions-4.14.1
commit: unknown.
Environment
- Python: 3.12
- Pydantic: 2.12.2
What Broke
Application fails to load dimensions, causing data retrieval issues.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.12.3
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/12414
First fixed release: 2.12.3
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if using custom validators that require the previous signature.
Verify Fix
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
| Version | Status |
|---|---|
| 2.12.3 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.