The Fix
pip install pydantic==2.10.3
Based on closed pydantic/pydantic issue #10945 · PR/commit linked
@@ -571,6 +571,15 @@ def deprecation_message(self) -> str | None:
return self.deprecated if isinstance(self.deprecated, str) else self.deprecated.message
+ @property
+ def default_factory_takes_validated_data(self) -> bool | None:
+ """Whether the provided default factory callable has a validated data parameter.
@override
def get_raw(self, item: str) -> Any:
if item in self._cache:
return self._cache[item]
field = self._config_model.model_fields[item]
if not field.is_required():
self._cache[item] = field.get_default(call_default_factory=True)
else:
raise KeyError(f"config item {item!r} has no default value.")
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.10.3\nWhen NOT to use: This fix is not applicable if the default factory does not require validated_data.\n\n
Why This Fix Works in Production
- Trigger: with the latest version of pydantic (`2.10.1`) and the mypy plugin, we observe some false positive with type validation.
- Mechanism: The default factory in Pydantic now accepts a validated_data argument, causing mypy to raise false positives
- Why the fix works: Add a property to check if the default factory callable has a validated data parameter, addressing the issue with mypy false positives. (first fixed release: 2.10.3).
Why This Breaks in Prod
- Shows up under Python 3.11 in real deployments (not just unit tests).
- The default factory in Pydantic now accepts a validated_data argument, causing mypy to raise false positives
- Production symptom (often without a traceback): with the latest version of pydantic (`2.10.1`) and the mypy plugin, we observe some false positive with type validation.
Proof / Evidence
- GitHub issue: #10945
- Fix PR: https://github.com/pydantic/pydantic/pull/11034
- First fixed release: 2.10.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.59
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“This is odd bc default_factory is typed as Callable[[], Any] | Callable[[dict[str, Any]], Any] | None”
“@Viicos i think your reply is not related to this issue.”
“Yes sorry I went to see the PR that mentioned the issue and thought it was the same person that raised it. In your case,…”
“In 2.10, default factories may accept a new validated_data argument”
Failure Signature (Search String)
- with the latest version of pydantic (`2.10.1`) and the mypy plugin, we observe some false positive with type validation.
- When running mypy over that piece of code, we observe that kind of error:
Copy-friendly signature
Failure Signature
-----------------
with the latest version of pydantic (`2.10.1`) and the mypy plugin, we observe some false positive with type validation.
When running mypy over that piece of code, we observe that kind of error:
Error Message
Signature-only (no traceback captured)
Error Message
-------------
with the latest version of pydantic (`2.10.1`) and the mypy plugin, we observe some false positive with type validation.
When running mypy over that piece of code, we observe that kind of error:
Minimal Reproduction
@override
def get_raw(self, item: str) -> Any:
if item in self._cache:
return self._cache[item]
field = self._config_model.model_fields[item]
if not field.is_required():
self._cache[item] = field.get_default(call_default_factory=True)
else:
raise KeyError(f"config item {item!r} has no default value.")
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Mypy reports false positive errors regarding default factory arguments during type validation.
Why It Broke
The default factory in Pydantic now accepts a validated_data argument, causing mypy to raise false positives
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.10.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/11034
First fixed release: 2.10.3
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if the default factory does not require validated_data.
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.10.3 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.