Missing required keys
The most common failure is a variable the app needs that is simply not set. The code reads process.env.DATABASE_URL, gets undefined, and either crashes on boot or — worse — falls back to an empty string and connects to nothing.
Catch it by validating against .env.example: any required template key (one with no default value) that is absent from the environment file is a missing key. Fix it by adding the key, even if the value is a placeholder you will fill in later.
Duplicate keys
When the same key is assigned twice in one file, most dotenv parsers keep the last assignment and silently discard the first. If the two values differ, you can spend hours debugging why the app ignores the value you can clearly see near the top of the file.
Collapse every key to a single assignment. A validator that reports duplicate keys with their line numbers makes these easy to spot in a long file.
Malformed lines and quoting errors
Lines that are not valid KEY=value pairs are a frequent source of trouble: a missing equals sign, a key with spaces or hyphens, an unterminated quote, or a value that spans lines without proper quoting. Some of these are dropped silently; others swallow the lines that follow them.
Quoting is its own trap. A hash inside an unquoted value can be read as the start of a comment, and a multiline value only works if it is wrapped in quotes. When in doubt, quote the value. A validator that understands dotenv syntax will flag the malformed line instead of letting the parser guess.
Undocumented and stale keys
Keys that exist in a real .env but not in .env.example are usually leftovers: a typo (DATABSE_URL), a variable from an old feature, or something added locally and never documented. They clutter configuration and hide real problems.
Treat the template as the source of truth and review every undocumented key: either add it to .env.example because it is legitimately needed, or delete it. The validator on this site lists missing, duplicate, malformed, and undocumented keys together, so a single pass turns a messy .env into a clean, documented one.