The Fix
pip install pydantic==1.10.17
Based on closed pydantic/pydantic issue #9690 · 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%.
@@ -1435,7 +1435,7 @@ def create_model(
__base__: None = None,
__module__: str = __name__,
- __validators__: dict[str, classmethod[Any, ..., Any]] | None = None,
+ __validators__: dict[str, Callable[..., Any]] | None = None,
__cls_kwargs__: dict[str, Any] | None = None,
python -c "import pydantic.version; print(pydantic.version.version_info())"
pydantic version: 2.7.4
pydantic-core version: 2.18.4
pydantic-core build: profile=release pgo=true
install path: /Users/foobar/1_10/.venv/lib/python3.11/site-packages/pydantic
python version: 3.11.4 (main, May 21 2024, 16:01:49) [Clang 15.0.0 (clang-1500.3.9.4)]
platform: macOS-14.4.1-arm64-arm-64bit
related packages: mypy-1.10.0 fastapi-0.105.0 typing_extensions-4.12.2
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==1.10.17\nWhen NOT to use: This fix should not be applied if strict type checking is required.\n\n
Why This Fix Works in Production
- Trigger: Mypy error on __validators__ when using create_model
- Mechanism: The type specification for __validators__ in create_model was too restrictive
- Why the fix works: Relaxed the type specification for `__validators__` values in `create_model` to allow more flexible validator types. (first fixed release: 1.10.17).
- 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.11 in real deployments (not just unit tests).
- The type specification for __validators__ in create_model was too restrictive
- Production symptom (often without a traceback): Mypy error on __validators__ when using create_model
Proof / Evidence
- GitHub issue: #9690
- Fix PR: https://github.com/pydantic/pydantic/pull/9697
- First fixed release: 1.10.17
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.52
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@jonathan-hill-visasq, Thanks for reporting this. Agreed, I think we can relax that annotation.”
Failure Signature (Search String)
- Mypy error on __validators__ when using create_model
Copy-friendly signature
Failure Signature
-----------------
Mypy error on __validators__ when using create_model
from pydantic import ValidationError, create_model, field_validator
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Mypy error on __validators__ when using create_model
from pydantic import ValidationError, create_model, field_validator
Minimal Reproduction
python -c "import pydantic.version; print(pydantic.version.version_info())"
pydantic version: 2.7.4
pydantic-core version: 2.18.4
pydantic-core build: profile=release pgo=true
install path: /Users/foobar/1_10/.venv/lib/python3.11/site-packages/pydantic
python version: 3.11.4 (main, May 21 2024, 16:01:49) [Clang 15.0.0 (clang-1500.3.9.4)]
platform: macOS-14.4.1-arm64-arm-64bit
related packages: mypy-1.10.0 fastapi-0.105.0 typing_extensions-4.12.2
commit: unknown
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Mypy raises type errors when using create_model with custom validators.
Why It Broke
The type specification for __validators__ in create_model was too restrictive
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.17
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/9697
First fixed release: 1.10.17
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if strict type checking is required.
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 |
|---|---|
| 1.10.17 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.