The Case of the Conflicting Base Template, and How Such an Alarming Situation Can Occur

I was recently working on a custom site settings item which needed a new base template. Once added, I got a scary warning about removing a base template during save. How can this be? All I did was add a new template! I reverted my change and in found that this warning was coming up even when trying save the template without making any changes at all. It's not my fault, man!


The Warning

Here you can see the warning you'll get whenever a base template is being removed, and as Martha Stewart says, that's “A good thing”.


Here's the rub. I didn't remove a template. As a matter of fact, I reverted all changes and just hit plain old save, and I still saw this issue. Now I'm concerned, because some time ago another consulting company had dropped a LOT of production data by removing base templates by accident. Was this related?

Finding the Issue

The first thing I did was believe the warning. I went into raw values (View -> Raw values) for the template and copied the Guids and checked one-by-one that they still exist. All were found since I first believe it to be a deleted base template with broken links.

Not sure where to go next, I went into the control panel and executed a rebuild of the link database (Database -> Rebuild link databases).

I looked back at the list of Guids, and it was right there in front of me, though impossible (sort of).


There's a duplicate entry here. This shouldn't be possible, since you'll receive the following warning when trying to add a base template twice.

As the Guid is in this field twice, Sitecore is performing a cleanup when I hit save. It's presenting the warning I showed earlier but not considering that the Guid is still in the field, something it should check and skip warning on in my opinion.

How Did This Happen?

More confused than upset, I reached out to this consulting agency I mentioned earlier. It turns out the developer thoughts the “You cannot select the same template twice” warning was in error, so she switched to raw values, added the Guid, saved and deployed. The duplication warning doesn't show when you're in raw values mode. 

You decide if upset was the proper emotion here!