Handle tokenization errors gracefully