Improve error messages for generated tokens