OhMyBug

logic/correctness

Dead Guard By Construction

#64rare9 sightingsfirst seen August 2026

What goes wrong

A production if-check tests a condition that the code before it (or the same change) has already made always true or always false, so the check never decides anything. A test that only asserts the check is present passes anyway.

Example

A check that the list is non-empty, inside a branch that is only entered when the list is non-empty.

Not to be confused with

The condition is fixed by how the code is built, not merely untested; a check that passes because its input is missing is Guard Skipped On Absent Input, and a guard defeated by the fix it prints is Remedy Escapes Guard.

Discovered by

Field notes · 2