You check a condition and act later, but something else can change it in between. The fix is to make check and use one atomic step, or to act on the thing you checked. See race condition.
TOCTOU
Time-of-check to time-of-use: the state changes between the check and the action that relied on it.