Symptom
Any fresh API process dies at import with ValidationError: E2B_DOMAIN must be non-empty when the key is absent from the environment — even though the field is declared str | None = None (optional).
Root cause
settings.py from_env() fills "" for every str-annotated field with a None default that is absent from the environment. Any field with a non-empty validator then rejects it: 'this optional key is missing' becomes 'this key is invalid'. Infisical also injects some keys as empty strings, triggering the same path.
Cost so far: every fresh boot broke until E2B_DOMAIN was added to Infisical, and the eval falsifiability checker failed with a misleading 'could not load cases' (the config error surfaced as a case error — separately fixed in 5d6ed9c0b on feat/evals, but the from_env root cause remains).
Expected
Absent optional key → None, and validators distinguish 'unset' from 'set but invalid'.
Found during eval-harness work (PR #907).
🤖 Generated with Claude Code
Activity
0No activity yet.