The Fix
Relaxed the check for validated data in default factory utilities to prevent breaking changes in Pydantic 2.10.
Based on closed pydantic/pydantic issue #10912 · 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%.
@@ -572,7 +572,9 @@ def deprecation_message(self) -> str | None:
@overload
- def get_default(self, *, call_default_factory: Literal[True], validated_data: dict[str, Any]) -> Any: ...
+ def get_default(
+ self, *, call_default_factory: Literal[True], validated_data: dict[str, Any] | None = None
from typing import ClassVar, List, Set
from pydantic import BaseModel, Field
class PrefectBaseModel(BaseModel):
_reset_fields: ClassVar[Set[str]] = set()
def reset_fields(self):
return self.model_copy(
update={
field: self.model_fields[field].get_default(call_default_factory=True)
for field in self._reset_fields
}
)
class TaskRun(PrefectBaseModel):
_reset_fields: ClassVar[Set[str]] = {"tags"}
name: str
tags: List[str] = Field(default_factory=list)
def main():
task = TaskRun(name="test-task")
task.tags.append("new-tag")
task.reset_fields()
if __name__ == "__main__":
main()
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Apply the official fix\nRelaxed the check for validated data in default factory utilities to prevent breaking changes in Pydantic 2.10.\nWhen NOT to use: This fix should not be used if the application relies on the previous behavior of default factories.\n\nOption C — Workaround\nversion above\nWhen NOT to use: This fix should not be used if the application relies on the previous behavior of default factories.\n\n
Why This Fix Works in Production
- Trigger: def get_default(self, *, call_default_factory: bool = False, validated_data: dict[str, Any] | None = None) -> Any:
- Mechanism: Relaxed the check for validated data in default factory utilities to prevent breaking changes in Pydantic 2.10.
- 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: def get_default(self, *, call_default_factory: bool = False, validated_data: dict[str, Any] | None = None) -> Any:
Proof / Evidence
- GitHub issue: #10912
- Fix PR: https://github.com/pydantic/pydantic/pull/10909
- Reproduced locally: No (not executed)
- Last verified: 2026-02-11
- Confidence: 0.60
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.23
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Hey folks! We've just released v2.10.1 with a fix for this issue! Let us know if you're still experiencing any difficulties. Thanks!”
“Just wanted to chime in that this broke creating new instances of SqlModels in the last few hours; will try and read through to understand…”
“> Any update on this? Broke our whole system. Let me know if we can help. Anyone knows the last working pydantic version? We should…”
“> EDIT: ok I think I get it. https://github.com/pydantic/pydantic/pull/10678, that's what we need to pass if we're going to tell it to call_default_factory at this…”
Failure Signature (Search String)
- def get_default(self, *, call_default_factory: bool = False, validated_data: dict[str, Any] | None = None) -> Any:
Error Message
Stack trace
Error Message
-------------
def get_default(self, *, call_default_factory: bool = False, validated_data: dict[str, Any] | None = None) -> Any:
...
if self.default_factory is None:
return _utils.smart_deepcopy(self.default)
elif call_default_factory:
if validated_data is None:
raise ValueError("'validated_data' must be provided if 'call_default_factory' is True.")
E ValueError: 'validated_data' must be provided if 'call_default_factory' is True.
Stack trace
Error Message
-------------
» python sandbox/repros/pydantic210.py
Traceback (most recent call last):
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 32, in <module>
main()
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 28, in main
task.reset_fields()
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 12, in reset_fields
field: self.model_fields[field].get_default(call_default_factory=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/github.com/prefecthq/prefect/.venv/lib/python3.12/site-packages/pydantic/fields.py", line 596, in get_default
raise ValueError("'validated_data' must be provided if 'call_default_factory' is True.")
ValueError: 'validated_data' must be provided if 'call_default_factory' is True.
</details>
Stack trace
Error Message
-------------
» uv run --with prefect==3.1.3 --with pydantic==2.10.0 sandbox/repros/pydantic210.py
Traceback (most recent call last):
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 34, in <module>
main()
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 28, in main
task.reset_fields()
File "/Users/nate/github.com/prefecthq/prefect/sandbox/repros/pydantic210.py", line 12, in reset_fields
field: self.model_fields[field].get_default(call_default_factory=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nate/github.com/prefecthq/prefect/.venv/lib/python3.12/site-packages/pydantic/fields.py", line 596, in get_default
raise ValueError("'validated_data' must be provided if 'call_default_factory' is True.")
ValueError: 'validated_data' must be provided if 'call_default_factory' is True.
» uv run --with prefect==3.1.3 --with pydantic@git+https://github.com/pydantic/pydantic.git@validated-data-fix sandbox/repros/pydantic210.py
Updated https://github.com/pydantic/pydantic.git (69e509ef)
name='test-task' tags=['new-tag']
Minimal Reproduction
from typing import ClassVar, List, Set
from pydantic import BaseModel, Field
class PrefectBaseModel(BaseModel):
_reset_fields: ClassVar[Set[str]] = set()
def reset_fields(self):
return self.model_copy(
update={
field: self.model_fields[field].get_default(call_default_factory=True)
for field in self._reset_fields
}
)
class TaskRun(PrefectBaseModel):
_reset_fields: ClassVar[Set[str]] = {"tags"}
name: str
tags: List[str] = Field(default_factory=list)
def main():
task = TaskRun(name="test-task")
task.tags.append("new-tag")
task.reset_fields()
if __name__ == "__main__":
main()
Environment
- Python: 3.12
- Pydantic: 2
Fix Options (Details)
Option A — Apply the official fix
Relaxed the check for validated data in default factory utilities to prevent breaking changes in Pydantic 2.10.
Option C — Workaround Temporary workaround
version above
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/pydantic/pydantic/pull/10909
Last verified: 2026-02-11. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application relies on the previous behavior of default factories.
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.
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.