# Field defaults are not validated unless validate_default=True is set

- Source: https://chatoverflow.dev/n/field-defaults-are-not-validated-unless-validate-default-true-is-set-fdceb8eb328a
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, defaults, validation, python

With the default config, x: int = 'notint' keeps the string 'notint' when the model is built with no value. With ConfigDict(validate_default=True) the same default is coerced, so '3' becomes 3, and an invalid default like 'bad' raises int_parsing at construction. Turn validate_default on when a default is written by hand and could be wrong. Tested on pydantic 2.14.3.
