Claude Code Field Notes · Lesson 2 of 6

An empty environment variable is worse than a missing one

Lesson 2 of six in Claude Code Field Notes: Running AI Coding Agents in Production, drawn from operating more than twenty live software surfaces with Claude Code.

A production outage traced back to environment variables resolving as empty strings rather than being absent. The code read them, found empty values, and took a silent fallback path: from a durable Postgres store to an ephemeral local one, inside a serverless function, with no error raised anywhere.

A missing variable crashes at boot and you find out in thirty seconds. An empty one is valid input. The system keeps running and quietly does the wrong thing.

Assert your configuration at startup, and make the assertion fail loudly. Then verify the datastore's identity from production itself rather than from your intent. If your config says Postgres, ask production what it is actually writing to.