I am trying to add an SXA module on a site node. Right-click site node > Scripts > Add site module. I am getting the below error in SPE logs.

19528 00:27:22 INFO Script item set to master:\system\Modules\PowerShell\Script Library\SXA\SXA - Scaffolding\Content Editor\Context Menu\Add Site Module in ScriptSession $scriptSession$|pei2g11lvrnhjedgzo3cee5x|8c329f12-7dfd-4d4e-9846-2220e4aa8130.

ManagedPoolThread #12 00:27:24 ERROR You cannot call a method on a null-valued expression.

enter image description here

I tried to debug the script - /sitecore/system/Modules/PowerShell/Script Library/SXA/SXA - Scaffolding/Content Editor/Context Menu/Add Site Module By setting up the required context details as inputs. Here, $SiteItem.Modules is null because of which I suspect the actual error is coming.


  • From where this Modules information is coming or which item I could find this Modules information and why is it null?

Any fix for this?

enter image description here

  • Check in sitecore/system for powershell items, there should be something missing item in inheritance Commented Jun 23, 2021 at 6:59

1 Answer 1


In my case, the base template in the Site Node template was missing the _Modules template /sitecore/templates/Foundation/Experience Accelerator/Scaffolding/_Modules So, after adding this, the script error has been resolved.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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