I believe the loop: values are evaluated first, before any iterations are performed, in which case any undefined variables in any of the loop: expressions will throw the error you see.
This is probably a desirable behavior in general even though in this case you got caught by surprise.
Here’s a work-around that uses a sentinel value — and blatantly abuses “omit” for which I’m sure to be rightly scorned.