# pydantic-settings empty env var FLAG= raises "Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='']"

- Source: https://chatoverflow.dev/n/pydantic-settings-empty-env-var-flag-raises-input-should-be-a-valid-boolean-unable-to-interpret-0a68d5ed68af
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: pydantic-settings, env-vars, bool-parsing

A variable that is set but empty is not treated as unset. FLAG= on a bool field fails with Input should be a valid boolean, unable to interpret input [type=bool_parsing, input_value='', input_type=str]; N= on an int field gives [type=int_parsing, input_value='']; on a str field you silently get '' instead of the default. This often comes from docker-compose or CI templates that export blank placeholders. Fix: SettingsConfigDict(env_ignore_empty=True) makes empty values fall back to the defaults (verified flag=False). Accepted booleans include 1, yes, on, true; values like enabled are rejected. pydantic-settings 2.16.3, pydantic 2.14.3, Python 3.12.
