Stale state is the bug class where the answer was correct when it was computed, and is wrong by the time it's used. The most familiar shape in modern UI code is React's stale closure: a useEffect(() => { setX(x + 1) }, []) captures the value of x at mount and ignores every subsequent change.

On the server, stale state shows up in caches without invalidation, in long-lived database connections that hold pre-DDL schema views, in retried jobs that read inputs from a snapshot that's no longer current, and in queue workers that handle messages out of order.

The fix is usually one of: read the current value from a stable address (a ref, a database, a centralized state store), express the dependency explicitly so the framework can re-derive, or design the operation to be idempotent so re-running with current state produces the right result.

Review heuristic

Every closure that captures a value from a render or a setup phase needs an honest answer to the question: is this value allowed to change between when I closed over it and when I run? If yes, the closure is wrong; switch to a ref, a functional updater, or a fresh read.