Loading
メール配信ドメイン検証状況の確認方法のご案内続きを読む
ヘルプサイトの計画メンテナンスに関するお知らせ続きを読む
ただいま大変多くのお問い合わせをいただいており、ご連絡までにお時間を頂戴しております続きを読む

Salesforce Metadata API Deployment Error: 'Element tabVisibilities Is Duplicated at This Location in Type Profile' When Deploying Profile XML

公開日: May 29, 2026
説明

Problem

When deploying a Salesforce Profile metadata file using the Metadata API or Salesforce CLI, the deployment fails with the following error:
"Error parsing file: Element [ElementName] is duplicated at this location in type Profile"
For example: "Error parsing file: Element tabVisibilities is duplicated at this location in type Profile"
This error occurs when the XML structure of the Profile metadata file is modified so that multiple occurrences of the same element type (such as tabVisibilities or userPermissions) are no longer grouped consecutively. In Salesforce Metadata API, all occurrences of the same element type within a complex type (such as a Profile) must be grouped together as a consecutive block in the XML file.

Root Cause: Non-Consecutive Element Grouping

The following XML snippet shows the correct structure — all tabVisibilities elements are grouped together before the userPermissions block:

<tabVisibilities>
<tab>TestObject__c</tab>
<visibility>DefaultOn</visibility>
</tabVisibilities>
<tabVisibilities>
<tab>TestObject2__c</tab>
<visibility>DefaultOn</visibility>
</tabVisibilities>
<userPermissions>
<enabled>true</enabled>
<name>ActivateContract</name>
</userPermissions>

The following snippet shows the incorrect structure that triggers the error — a tabVisibilities element appears after a userPermissions block, breaking the required consecutive grouping:

<tabVisibilities>
<tab>TestObject__c</tab>
<visibility>DefaultOn</visibility>
</tabVisibilities>
<userPermissions>
<enabled>true</enabled>
<name>ActivateContract</name>
</userPermissions>
<tabVisibilities>
<tab>TestObject2__c</tab>
<visibility>DefaultOn</visibility>
</tabVisibilities>
解決策

How to Fix the Duplicated Element Error

In Salesforce Metadata API, when a Profile XML file contains multiple occurrences of the same element type (such as tabVisibilities, userPermissions, fieldPermissions, and others), all occurrences of that element must be grouped together consecutively in the XML file. They cannot be split apart by other element types.
To resolve the error:

  1. Open the Profile metadata XML file.
  2. Identify all occurrences of the element type named in the error message (for example, all `` elements).
  3. Move all occurrences of that element type so they form a single consecutive group in the file, not separated by any other element types.
  4. Save and redeploy the Profile metadata file.

 

Note: This rule only applies when there are multiple occurrences of the same element type. A Profile with only a single `` element is not affected.
ナレッジ記事番号

000383335

 
読み込み中
Salesforce Help | Article