There seems to be one TM interfering with another. Looking at the template code won't help, you need to look at each TM and see what are modifying. The easiest way is to turn off each TM for that template, save your new mod (to see if it works), and then turn on the others one at a time until the compiler error returns. when it does, look at the modification code to see what it is doing to the template.
One bad template mod will cause all mods for that template to fail.