The .env Mistake That Breaks the Deploy
By toolbelt maintainers ·
Updated
A stray quote swallows the next line. The app starts, one variable is undefined, and you spend an hour on it.
What is this tool?
A .env file stores configuration as KEY=value pairs. Loaders are permissive, which means mistakes do not fail loudly — they fail later, as undefined values in production.
How it works
Each non-comment line is split on the first equals sign. I check the key against the conventional pattern, track duplicates, look at quote balance, and flag unquoted spaces. Findings are reported with line numbers.
Example
API_KEY="sk-live-abc DEBUG=true Line 1 has an unclosed quote. Without the closing quote, DEBUG becomes part of the key.
When to use it
Before the first deploy of anything new. When a variable is undefined in production but set locally. After pasting a block of variables from documentation, which is where stray quotes come from.
Optimization Tips
Quote anything containing a space or a hash. Do not commit a real .env — commit a .env.example with placeholders. And remember that most loaders give you strings, so "false" and false behave differently depending on your config library.
Frequently Asked Questions
Why is a duplicate key a problem?
What counts as an inline comment?
Are my secrets stored?
Does it handle export prefixes?
Related tools
- Base64 Encoder/DecoderEncode and decode Base64 strings safely. Supports full UTF-8 characters, emojis, and binary data. Ideal for debugging data URLs or API authentication headers.
- URL Encoder/DecoderPercent-encode and decode URLs. Safely escape query parameters, path segments, or full URLs to ensure they are valid and won't break during browser routing or API requests.
- JWT DecoderDecode JSON Web Tokens to inspect the header and payload. Debug authentication flows, check expiration times, and view user roles without verifying the signature.
- JWT SignerCreate a signed JSON Web Token with HMAC SHA-256, SHA-384 or SHA-512. Encode the header and payload and sign it from a secret, entirely in your browser.