Sitecore SXA: Create Site failure

Reading Time: 3 minutes

We have recently encountered very strange issue when we have tried to create a new SXA Site under Tenant which already contained other Sites.

 

Problem definition

You are creating new Site by right clicking on Tenant and from insert options you choose “Site”:

sxacreatesite00

Instead of expected wizard where you are setting site name, choosing modules to install, grid settings and others, we saw this:

sxacreatesite01

or textually “Something went wrong. See SPE logs for more details”.

We went then to SPE log and saw these log entries:

11144 14:33:25 INFO Executing PsSitecoreItemProvider5.Start(providerInfo='Sitecore')
10148 14:33:26 INFO Script item set to master:\system\Modules\PowerShell\Script Library\SXA\SXA - Scaffolding\Content Editor\Insert Item\Site in ScriptSession $scriptSession$|bknc1r0bpwhy41rvkn1kf1cx|8d21d358-0513-4fe4-b708-b5340a2eb9a6.
ManagedPoolThread #9 14:33:26 INFO Executing a script in ScriptSession '$scriptSession$|bknc1r0bpwhy41rvkn1kf1cx|8d21d358-0513-4fe4-b708-b5340a2eb9a6'.
ManagedPoolThread #9 14:33:35 ERROR Cannot convert value "" to type "Sitecore.Data.ID". Error: "Empty strings are not allowed.
Parameter name: value"
ManagedPoolThread #9 14:33:35 INFO The script execution in ScriptSession '$scriptSession$|bknc1r0bpwhy41rvkn1kf1cx|8d21d358-0513-4fe4-b708-b5340a2eb9a6' completed in 8940 ms.

The most important log entry from this list is this one:

ManagedPoolThread #9 14:33:35 ERROR Cannot convert value "" to type "Sitecore.Data.ID". Error: "Empty strings are not allowed.
Parameter name: value"

Solution

To find the solution, we first had to find root cause of above error.

It was actually pretty easy at the end.

First step was to analyze the script itself mentioned in log entries:

master:\system\Modules\PowerShell\Script Library\SXA\SXA - Scaffolding\Content Editor\Insert Item\Site

This is the most important content of that script for further analysis:

sxacreatesite02

This led my colleague Akos to check New-Site function located under path “/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA – Scaffolding/Functions/Scaffolding/Site/New-Site”.

From this script, Get-ValidSiteSetupDefinition function is called under path “/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA – Scaffolding/Functions/Scaffolding/Site/Get-ValidSiteSetupDefinition”

Last script which is called here was function Get-InvokedTenantAction located here “/sitecore/system/Modules/PowerShell/Script Library/SXA/SXA – Scaffolding/Functions/Cmdlets/Get-InvokedTenantAction”.

Script actually fails on line 57 where it is trying to get Insert Options which as you know are stored in field __Masters.

This is the code that caused trouble:

[Sitecore.Data.ID[]]$baseTemplates = $standardValuesHolder."__Masters".Split('|')

As we have found out, Insert options (therefore __Masters field) was empty on Standard values of Page template and therefore the script failed:

sxacreatesite03

We have then set them to Page:

sxacreatesite04

And all started to work again and we saw much anticipated wizard with all bits and pieces to set:

sxacreatesite05

 

This is problem was registered as bug as mentioned by Gert Gullentops on Sitecore StackExchange -> https://sitecore.stackexchange.com/a/18856/2056 but above you have quick fix that you can apply now without contacting Sitecore Support 🙂

Cheers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.