Hi @Kamil Buszmann ,
The error message "Value does not fall within the expected range" occurs when trying to apply a template for a site, specifically when applying a column called "_ModernAudienceAadObjectIds" to a list instance. This error message often appears when a list item or a field contains too much data, or when the value is too long.
To troubleshoot this issue, try the following steps:
1.Check the specific column "_ModernAudienceAadObjectIds" for any unusual or long values and try shortening it.
2.Ensure that the column is added to the list or library and that it exists.
3.If the issue persists, you can try debugging your script to identify and isolate the issue.
One post on GitHub suggests that after applying a PnP template, site admins should disable and enable audience targeting again in list settings to remove fields
_ModernAudienceAadObjectIds and then recreate them properly.
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
Hope the information can help you. And if there have any unclear or misunderstanding, please feel free to post back and we’ll continue to help you all the time!
Your understanding and patience will be highly appreciated! Hope you have a good day and keep safe!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.