Be able to stop the game.
Detect three-fold repetition.
Make sure there are moves.

I hit this error when I was in the middle of moving a piece when the game ended (three-fold repetition).