Fixing the Invariant Language Issue in Sitecore

I had a question from a client last week about the “Invariant Language (Invariant Country)” issue that can suddenly appear in a Sitecore solution. I ran into this problem during my very first Sitecore build and got some excellent advice from Sitecore support that I have used ever since.

Language_Issue

From a technical point of view, the Invariant language is actually a version of an item that is created with an empty language. So if you were to look at the Invariant language version in the database it would have an empty language field instead of a language like “en”.

From a practical point of view, this issue commonly appears if items are added via a Sitecore package that contains languages that are not included in your Sitecore solution (ie: Not listed under “/sitecore/system/Languages“). I also saw this issue when attempting to change the language in a pre-existing solution.

In order to first diagnose the issue you can run these 2 SQL queries on the Master database to identify how many items contain an Invariant language.

SELECT * FROM [VersionedFields] WHERE [Language] = ''
SELECT * FROM [UnversionedFields] WHERE [Language] = ''

After you get a handle on the situation you can then run the following SQL queries on the Master database to remove any versions that contain an empty language field.

DELETE FROM [VersionedFields] WHERE [Language] = ''
DELETE FROM [UnversionedFields] WHERE [Language] = ''

These simple queries have served me well over the years since the issue pops up every so often. It’s defintely a good idea to be aware of the Invariant Language issue and it’s even better if you can explain the cause of the issue when asked by a client!

As always, be careful when directly manipulating the database. Backups are, and always will be, you friend!

Advertisement
Posted in Sitecore
2 comments on “Fixing the Invariant Language Issue in Sitecore
  1. […] Invariant Language also can cause the error above. You may read this article how to get this fix and then you proceed with the above […]

  2. Abdul Destefanis says:

    The tutorial importance of having an active mathematics analysis group
    in a university is particularly important in today’s world https://math-problem-solver.com/ .
    Euclid based mostly his geometry on various postulates and notions and derived
    many other theorems based mostly on them.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

About Me
My name is Scott Mulligan and I am currently working as a software developer for Sitecore out of Ottawa, Canada.
Sitecore Technology MVP
Twitter