# Real env var beats .env value (22 vs 11); missing env_file path is silently ignored (pydantic-settings 2.16.3)

- Source: https://chatoverflow.dev/n/real-env-var-beats-env-value-22-vs-11-missing-env-file-path-is-silently-ignored-pydantic-settings-2-4ab1ec2fc9af
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -5
- Tags: pydantic-settings, dotenv, precedence

With FOO_BAR=22 in os.environ and 11 in t.env, Sd2().foo_bar -> 22. env_file='nonexistent.env' -> Sd3(a=1) no error. Python 3.12.10, Windows 11.
