6

I have Sitecore 8.2 rev 160729 installed with SXA 1.0 and Sitecore Publishing Service 1.8.0. During an upgrade to SXA 1.1 I receive the following message:

ItemLocator language cannot be null or empty Parameter name: language

Outlined in the upgrade guide for SXA is the following (which I have done).

  • Remove the following files:
    • Website\App_Config\Include\Feature\Sitecore.XA.Feature.Annotations .config
    • Website\bin\Sitecore.XA.Feature.Annotations.dll
    • Website\Views\Annotation\Annotation.cshtml

Log error messages:

ManagedPoolThread #19 20:07:15 ERROR Failed to save the item. Item ID: {AD71FACC-3C23-4DF8-A427-672020DB5612}, database: master
Exception: System.ArgumentOutOfRangeException
Message: ItemLocator language cannot be null or empty
Parameter name: language
Source: Sitecore.Framework.Publishing.Abstractions
   at Sitecore.Framework.Publishing.Data.Model.ItemLocator..ctor(Guid id, String language, Int32 version, Nullable`1 revision, String store)
   at Sitecore.Publishing.Service.PublishManager.EmitItemEvent(Item item, DateTime timestamp, ItemOperationRestrictions restrictions, PublisherOperationType operation, String itemPath)
   at Sitecore.Publishing.Service.PublishManager.DataEngine_SavedItem(Object sender, ExecutedEventArgs`1 e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)
   at Sitecore.Data.Engines.EngineCommand`2.Execute()
   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
ManagedPoolThread #19 20:07:15 ERROR Error installing items/master/sitecore/templates/Branches/Feature/{AD71FACC-3C23-4DF8-A427-672020DB5612}/en/1/xml
Exception: System.ArgumentOutOfRangeException
Message: ItemLocator language cannot be null or empty
Parameter name: language
Source: Sitecore.Framework.Publishing.Abstractions
   at Sitecore.Framework.Publishing.Data.Model.ItemLocator..ctor(Guid id, String language, Int32 version, Nullable`1 revision, String store)
   at Sitecore.Publishing.Service.PublishManager.EmitItemEvent(Item item, DateTime timestamp, ItemOperationRestrictions restrictions, PublisherOperationType operation, String itemPath)
   at Sitecore.Publishing.Service.PublishManager.DataEngine_SavedItem(Object sender, ExecutedEventArgs`1 e)
   at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
   at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)
   at Sitecore.Data.Engines.EngineCommand`2.Execute()
   at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
   at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item)
   at Sitecore.Data.Managers.DefaultItemManager.ExecuteAndReturnResult[TArgs,TResult](String pipelineName, String pipelineDomain, Func`1 pipelineArgsCreator, Func`1 fallbackResult)
   at Sitecore.Data.Managers.DefaultItemManager.SaveItem(Item item)
   at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)
   at Sitecore.Data.Items.ItemEditing.EndEdit(Boolean updateStatistics, Boolean silent)
   at Sitecore.Install.Items.ItemInstaller.GetVersionInstallMode(PackageEntry entry, ItemReference reference, XmlVersionParser parser, ItemInstallerContext context, Boolean& removeVersions)
   at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)

Update

While waiting for a future release to come out that addresses the bug called out by Stephen, I've taken the following steps to ensure proper installation of packages. I needed to do this because the SPE module installation would halt as soon as the error was encountered.

  • Disable Sitecore.Publishing.Service.config
  • Install Sitecore PowerShell Extensions module (or any module that encounters the error)
  • Enable Sitecore.Publishing.Service.config
  • 1
    I updated SXA yesterday without any problems. I was able to reproduce your issue when I installed Sitecore Publishing Service. What is more I was able to reproduce it with SPE package as well (could confirm if you can as well?) ERROR Error installing items/master/sitecore/templates/Modules/PowerShell Console/{5FB5EB9F-41C5-43DD-B9F7-70A482B21093}/en/1/xml – Alan Płócieniak Oct 7 '16 at 6:28
  • Hey Alan, just saw your message. I updated my question to confirm that SPE encounters the issue during installation. – Michael West Nov 17 '16 at 19:56
8

TL;DR

You can ignore the errors as long as you make sure you publish the installed items with a Full or Single Item publish.

The details

We have tested this and confirmed this as platform bug in 8.2 (rev 160729), when a package is installed the SaveItem event is not passed a language.

This doesn't effect how Sitecore saves the item data itself, but the PublishingService saves this data to mark an item as 'needing to be published'.

The service is sensitive to items that do not have a language and we have guard conditions to catch them (as they would be illegal items as far as we are concerned) so this is why the error is thrown.

This needs to be fixed in the platform but we are looking to see if there is a workaround or patch we can issue but with a null language being returned with the item data we can't tell the difference between different language versions of an item being installed.

Possible workaround

When an item is created/edited/removed then an entry is added to the PublishOperation table. The entries in this table work in a similar way to the old Publish Queue and tell us what has changed since the last publish. Without a language being passed to the SaveItem event handler an error is thrown. The item is still installed into Sitecore but this entry is missing in the table.

The result of this is that if you do a Site Publish (in old terms an incremental publish) then these recently installed items will not be marked as needing to be published and so will be skipped.

If you are installing a large module where items could be in lots of different parts of the content tree then the workaround is, when you need to publish next, then to do a Full Publish (as an admin function from the Publishing Dashboard); this will publish only the changed items anyway (and the service is much faster than before!).

If you are installing a package to a very specific part of the content tree then you can do a Single Item Publish (with subitems) from a parent node. This will have the same effect.

Both of these methods work their way down the tree looking for changed items and don't use the PublisherOperation entries so the newly installed items will be picked up.

  • Appreciate your help Stephen. – Michael West Oct 7 '16 at 12:41
6

Assuming you have correctly configured Sitecore Publishing Service (I have not) you should raise support bug for that.

Here is what I have found:

Whenever you try to install an item with Overwrite option the installation will fail. Doesn't matter what package and what is inside.

You can check this by creating a new package with Sitecore standard item and then install it on your instance with overwrite.

Steps to reproduce that issue:

  1. Install Sitecore
  2. Install Sitecore Publishing Service
  3. Create package with any existing item
  4. Try to install package, when asked by SItecore how to resolve issue, select Overwrite option.

Boom

ManagedPoolThread #8 08:55:14 ERROR Error installing items/master/sitecore/layout/Controllers/{75D27C2B-5F88-4CC8-B1DE-8412A1628408}/da/1/xml Exception: System.ArgumentOutOfRangeException Message: ItemLocator language cannot be null or empty Parameter name: language Source: Sitecore.Framework.Publishing.Abstractions at Sitecore.Framework.Publishing.Data.Model.ItemLocator..ctor(Guid id, String language, Int32 version, Nullable1 revision, String store) at Sitecore.Publishing.Service.PublishManager.EmitItemEvent(Item item, DateTime timestamp, ItemOperationRestrictions restrictions, PublisherOperationType operation, String itemPath) at Sitecore.Publishing.Service.PublishManager.DataEngine_SavedItem(Object sender, ExecutedEventArgs1 e) at System.EventHandler1.Invoke(Object sender, TEventArgs e) at Sitecore.Data.Engines.EngineCommand2.RaiseEvent[TArgs](EventHandler1 handlers, Func2 argsCreator) at Sitecore.Data.Engines.EngineCommand2.Execute() at Sitecore.Data.Engines.DataEngine.SaveItem(Item item) at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item) at Sitecore.Data.Managers.DefaultItemManager.ExecuteAndReturnResult[TArgs,TResult](String pipelineName, String pipelineDomain, Func1 pipelineArgsCreator, Func`1 fallbackResult) at Sitecore.Data.Managers.DefaultItemManager.SaveItem(Item item) at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent) at Sitecore.Data.Items.ItemEditing.EndEdit(Boolean updateStatistics, Boolean silent) at Sitecore.Install.Items.ItemInstaller.GetVersionInstallMode(PackageEntry entry, ItemReference reference, XmlVersionParser parser, ItemInstallerContext context, Boolean& removeVersions) at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)

  • Then I suspect the issue is the SXA package was created by SPE and the default setting in the project file is Overwrite. – Michael West Oct 7 '16 at 11:37
  • Well SPE is not an issue but could confirm the package configuration you suggested. – Michael West Oct 7 '16 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.