Fix null grammar detection bug from refactor.

This fixes a bug propagated by moving the handleError code outside of where the messages were created.