# An environment variable is “undefined”

**What you see:** The app says a key is missing or `undefined`.

**Why it happens:** The name doesn't match, it's not set in that environment, or the app hasn't restarted since you added it.

## How to fix it

1. Ask your agent to run the check that says “set” or “missing” for each variable.
2. Fix the name or add the value yourself (VS Code for `.env.local`, Vercel's website online).
3. Restart the app, or redeploy online.

## Message for your agent

```text
An environment variable is undefined. Run the env check (names only, never values), tell me which one is missing and where I should add it.
```

**How to prevent it:** Keep `.env.example` up to date with every name the app needs.

---
Source: [Agentic Makers](https://agenticmakers.app/en/help/environment-variable-undefined) · License: CC BY 4.0
