emit errors when appropriate