template: Improve the template error messages