When creating templates, you may receive the "unbalance tags" error depending on the contents of your template.
The first thing to check should be the banner. A majority of the time, the error arises if the banner includes any %, <, >, [, ], (, or ) marks. These marks are special characters which are used with the following conditions:
The following variables may be used in the template. The value of each variable is configured on the APs/Devices Manage page for each device in the group. Each variable must be surrounded by percent signs: %hostname%. The %if...% statements must be terminated by %endif% and cannot be nested.
<ignore_and_do_not_push></ignore_and_do_not_push>, , <push_and_exclude></push_and_exclude> and () tags can be used to achieve a good configuration.
Once you've made certain that your banner doesn't make use of the stated symbols. Check to make sure that if you have used any of these special characters that there is both an opening and closing for each instance. For example, if there's a '(' then there must be a ')' to close the statement.