Why environment-variable linters cry wolf

Across four production repositories, a config analyser produced 239 findings. 215 of them were wrong. Here is every one, grouped by the belief that caused it.

The repositories are outline, immich, documenso and netbox — about 11,000 files across TypeScript, Python, Go, Rust, Ruby and Dart. Nothing here is hypothetical: every false finding below was produced, diagnosed, and then turned into a regression test.

98 — "a variable nothing reads is dead config"

The single largest class. A GitHub Actions workflow sets BOT_NAME under env:, and no source file mentions it. Dead, surely. Except the next run: step says echo "$BOT_NAME", and one of them pipes it through a jq program that reads env.BOT_NAME.

The fix is not a bigger grep. It is noticing that evidence is asymmetric: a bare $FOO in a shell line is far too weak to prove that something is required — it may be a typo, or optional, or someone else's variable — but it is entirely strong enough to prove that something is not dead. Those two questions deserve different standards of proof, and conflating them is what makes a tool noisy.

31 — "if the example file does not mention it, it is undocumented"

outline declares its settings in a validated class. The field is the documentation: name, type, whether it is optional, often a comment. Reporting each one as "read but never declared" is telling the author that their own declaration does not count.

What remains true is narrower and more useful: the variable is absent from .env.sample, so a developer following the project's own setup instructions never learns it exists. That is a documentation gap, with a different fix, and it belongs in a different section of the report.

23 — "the tests read it, so it must be configured"

A test that does process.env.STRIPE_KEY = 'sk_test_x' two lines before reading it is not telling you about your deployment. Neither is patch.dict(os.environ, {...}). Code that sets a variable and then reads it is self-contained, and quoting it back as a configuration requirement is noise.

11 — "this folder is called client, so it ships to browsers"

The "secret in the bundle" finding is one of the genuinely valuable ones: a NEXT_PUBLIC_ variable holding something sensitive really is downloadable by every visitor. But deciding what is browser code by directory name does not survive contact with real repositories. documenso keeps its job-queue SDK in packages/lib/jobs/client/, where client means a client of Redis. Seven server-only variables were reported as published secrets.

The test has to be evidence in the file itself — a component file extension, or an explicit "use client" — not a word in a path.

10 — "the validator ends at the end of the line"

A schema field written as FOO: z.string() on one line and .optional() on the next is optional. Measuring the validator chain to the end of its first line marks ten optional fields as required. Measuring to the next schema key fixes it. A variant of the same mistake: a decorator check that looked three lines up and found the neighbouring field's @IsNotEmpty().

7 — "variables appear as process.env.NAME"

immich keys a zod object by variable name — IMMICH_BUILD_IMAGE: z.string().optional() — and never writes those names anywhere else. To a scanner looking for property access, every build-metadata variable in the project simply does not exist, so all of them look dead. Sometimes the validator is a named constant defined fifty lines earlier, which has to be resolved too.

4 — "every key in this config file is a variable"

Heroku's app.json nests variables under an env object, each with its own description, required, generator and value. Flatten it carelessly and the tool starts reporting that your application needs an environment variable called description. The same trick turned turbo.json's task keys into variables.

2 — "capitalised identifiers are environment variables"

SAD and SCAL are fields of a document-signing protocol in documenso. They are capitalised because the specification capitalises them. A schema whose keys are mostly ordinary camelCase is not an environment schema, whatever two of its fields look like.

1 — "a subscript is a read"

env["MACHINE_LEARNING_DEVICE_ID"] = value is an assignment. Counting it as a read means reporting that the program requires a variable it is in the middle of setting itself. One line of fix: require a load context, not a store.

What was left

24 findings, checked by hand against each repository. Three worth repeating:

The one distinction worth stealing

If you take a single idea from this: in JavaScript, a missing environment variable is undefined. It is not an exception. os.environ["X"] raises; process.env.X shrugs and returns nothing, and your application starts anyway with the integration quietly switched off.

So "has no default" and "is required" are different claims. Treating them as one put 77 variables on outline's must-be-set-before-boot list. The true number is one.

See the four reports, and the tool

More measured notes on coding agents: alexenabled.github.io