Turn the loop inside out so we can raise an error.