Quick answers for diagnosing and fixing a Business Module Provisioning job that fails with "Sequence contains no matching element".
What error am I seeing?
System.InvalidOperationException: Sequence contains no matching element
Raised during Site Collection Provisioning, before the new site is created. The job fails and no site is provisioned.
What causes it?
A corrupted Managed Metadata (Taxonomy) or Calculated field on the root site.
Most often: a Taxonomy column's paired hidden text field has been deleted or was never correctly created, so template extraction can't resolve the reference.
For background on the pairing rules, see GUID limitation for ID on Managed Metadata Fields.
How do I find the broken field?
Run this PnP PowerShell script against the affected root site. Rows with Status = Error identify the offending field.
param(
[Parameter(Mandatory)][string]$SiteUrl,
[string]$ClientId
)
Connect-PnPOnline -Url $SiteUrl -Interactive -ClientId $ClientId
$fields = Get-PnPField -Includes Id, InternalName, Title, TypeAsString, Hidden
$taxonomyFields = $fields | Where-Object {
$_.TypeAsString -in @("TaxonomyFieldType","TaxonomyFieldTypeMulti")
}
$results = foreach ($f in $taxonomyFields) {
try {
Get-PnPProperty -ClientObject $f -Property TextField
$txt = $f.TextField
if ($null -eq $txt) {
[PSCustomObject]@{ Field=$f.InternalName; Status="Error"; Message="TextField property is missing" }
}
elseif (-not ($fields | Where-Object { $_.Id -eq $txt })) {
[PSCustomObject]@{ Field=$f.InternalName; Status="Error"; Message="Referenced hidden field does not exist" }
}
else {
[PSCustomObject]@{ Field=$f.InternalName; Status="OK"; Message="Valid" }
}
} catch {
[PSCustomObject]@{ Field=$f.InternalName; Status="Error"; Message=$_.Exception.Message }
}
}
$results | Format-Table -AutoSize
$results | Export-Csv ".\TaxonomyFieldValidation.csv" -NoTypeInformation
Run it as:
.\Validate-TaxonomyFields.ps1 -SiteUrl "https://<tenant>.sharepoint.com/sites/<site>" -ClientId "<entra-app-client-id>"
How do I fix it?
For each field flagged as Error:
- Not needed anymore? → Delete the orphan Taxonomy field.
- Still in use? → Recreate it correctly, following the GUID pairing convention in the reference article.
Then retry the provisioning job.
⚠️ Always verify no lists or content types depend on the column before deleting.
What if the script finds no errors?
Also check the root site for:
- Calculated fields referencing columns that no longer exist.
- Lookup fields pointing to deleted lists.
Repair or remove any field with broken references, then retry.
Still failing?
Open a support ticket with:
- Affected site URL
-
TaxonomyFieldValidation.csvoutput - Timestamp (UTC) of the failed attempt
- Installed WorkPoint version
Comments
0 comments
Please sign in to leave a comment.