Why TDS may want to sync non-existing item versions

I recently ran into a strange issue where I noticed TDS wanted to sync a lot of item versions that didn’t exist. It took me a while before I nailed what was actually causing this. In the example below, the “Home” item only have a “en” language version. There is no version on the other languages. Still, TDS wants to serialize many more languages.

If I serialize this item into disk, it indeed adds all these versions as well.

Note: This is not a problem with TDS itself. It’s a consequence of a faulty database.

It turned out that the cause of this was an invalid row in the database. If there is a row with an empty Language field, it somehow assumes there is a language version available on every installed language:

I haven’t verified all combination, but I’ve been able to reproduce this behavior under the following circumstances:

  • YML file serialization enabled
  • Language fallback enabled
  • More than one language installed in Sitecore
  • One version on “en” for the item being serialized
  • An Unversioned field value with an empty language string

It seems like this problem doesn’t happen on Versioned fields and it seems like Language fallback doesn’t have to be enabled on the field itself. I’m not sure if this YML serialization is required.

Running a database cleanup from within Sitecore doesn’t solve this problem, but by just removing the invalid rows in the database solves it:

DELETE FROM UnversionedFields WHERE Language LIKE ''

I’ve seen such rows with empty language fields in many Sitecore instances. I’ve haven’t yet found a reproduceable way to make them appear, but I’m getting closer. This time it happened when I created a Sitecore package from another instance and installed it on my local dev machine. The source instance didn’t have the empty language records. I also examined the Sitecore package itself and it looked as expected. So this boils down to the package install process, as the Created and Updated fields of those invalid rows, have the timestamps of when I installed the package. I’ve spent just a few minutes trying to reproduce this with more packages, but so far no luck.

Leave a Reply