When you are using Office Dev PnP Powershell and got some issues, you would probably like to investigate what is going wrong. For example when you try to apply provisioning templates. You created some huge xml template with security, propertybag, lists, document libraries, columns, contenttypes etc. but it fails.
See below for an example.
I connect to a site collection to try to apply template provisioning. The template xml file contains some custom contenttype which is using some custom columns. One of the custom columns is missing in the template. I remove it for this example to trigger the issue.
Like you see in the error message, it is not clear what is happening or in which handler this error is throwed!
Lets enable the trace logging to see detail information when you run Office Dev PnP commands. This is the command to enable it:
Set-PnPTraceLog -On -Level Debug
I will try to apply template provisioning again.
You will see now detail trace logging for each step Office Dev PnP Powershell is doing. And you will see also the last step before you see the error.
In my situation you will see in the trace logging that Office Dev PnP Powershell is trying to add field with ID “c5a3f785-d2e6-4da0-a266-58f3efc3e424” to contenttype with ID “0x0100CF703D406F79AA4BB10738F45E219B45”.
So you need to investigate in your PnP template why you are missing the field with ID “c5a3f785-d2e6-4da0-a266-58f3efc3e424”.