Unquoted Spaces
What it detects
Values in .env that contain spaces but are not wrapped in quotes ("..." or '...').
Example
Given .env:
APP_NAME=My ApplicationAPP_ENV=productionDB_HOST=localhostTITLE=Hello Worldenvaudit reports:
Unquoted values with spaces (in .env) ✗ APP_NAME (line 1) Wrap in quotes: APP_NAME="My Application" ✗ TITLE (line 4) Wrap in quotes: TITLE="Hello World"Why it matters
Most dotenv parsers (PHP, Ruby, and some Node.js implementations) treat unquoted spaces as a syntax error:
The environment file is invalid!Failed to parse dotenv file. Encountered unexpected whitespace at [My Application].This is a common issue when deployment tools generate .env values via sed or templating without wrapping them in quotes. The error only surfaces at runtime, often in production.
How to fix
Wrap the value in double or single quotes:
APP_NAME=My ApplicationAPP_NAME="My Application"Both double quotes and single quotes are accepted:
APP_NAME="My Application"APP_NAME='My Application'Edge cases
KEY=value # comment— the inline comment is stripped before checking;valuehas no space, so this is fineKEY=two words # comment—two wordshas a space, so this is flaggedexport KEY=My App— theexportprefix is stripped; the unquoted space is detected