Raise error if iteration ends without walking size elements.

Fixes #1182.