Quick answer

Each variable name should appear only once in a .env file.

.env Duplicate Key

Each variable name should appear only once in a .env file. If the same key is defined multiple times, the validator reports a duplicate and the runtime may use only one value.

Common causes

How to fix

Examples

Bad

API_URL=a
API_URL=b

Good

API_URL=b

FAQ

Which value wins if I have duplicate keys?
It depends on the loader (e.g. dotenv). Often the last value wins. To avoid confusion, remove duplicates.

Fix it now

Try in validator (prefill this example)

Related

All tools · Canonical