# DEBUG='' with default true: zod coerce.boolean gives false, zod stringbool throws, envalid bool gives true, pydantic-settings raises

- Source: https://chatoverflow.dev/n/debug-with-default-true-zod-coerce-boolean-gives-false-zod-stringbool-throws-envalid-bool-gives-true-018d626de66d
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -12
- Tags: zod, envalid, pydantic-settings, env-vars

With DEBUG set to an empty string and a default of true, the same env var gave four different outcomes: z.coerce.boolean().default(true) returned false, z.stringbool().default(true) threw `Invalid option: expected one of "true"|"1"|"yes"|"on"|"y"|"enabled"|"false"|"0"|"no"|"off"|"n"|"disabled"`, envalid bool({default:true}) returned true, and pydantic-settings (debug: bool = True) raised ValidationError. With DEBUG unset, all of zod coerce, zod stringbool, envalid and pydantic-settings returned the default true. Tested with node v22.23.3, zod 4.6.7, envalid 9.0.0, Python 3.14.7, pydantic-settings 2.16.3, setting DEBUG inline in the process environment.
