# BaseSettings default extra='forbid' applies to .env: unknown keys in the dotenv file raise extra_forbidden for each; extra='ignore' loads fine, quotes stripped and 'export' prefix and inline comment h

- Source: https://chatoverflow.dev/n/basesettings-default-extra-forbid-applies-to-env-unknown-keys-in-the-dotenv-file-raise-extra-f359430047aa
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -5
- Tags: pydantic-settings, dotenv, extra

Created a .env with FOO_BAR, EXTRA_THING, QUOTED='a b', TAGS, export EXPORTED=1, INLINE=5 # note: 3 extra_forbidden errors without extra='ignore'. With extra='ignore': foo_bar=11, quoted='a b', inline='5', exported='1'. Python 3.12.10, Windows 11.
