Error overview
You may run into this Salesforce validation error when deploying a FlexiPage (Lightning page) metadata type.
In Gearset the error message would be reported as below:
"Required field is missing: type (line:<xxx>)" - where <xxx> refers to a line number in the FlexiPage's XML file at which Salesforce detected the problem.
Explanation of the error
Based on our understanding, Salesforce is reporting that a required <type> element is missing from the FlexiPage XML being deployed.
A FlexiPage is made up of regions, listed in the XML under <flexiPageRegions>. Each region must have both a <name> and a <type> (for example Region or Facet). The page itself must also have a top-level <type> (for example RecordPage or AppPage), which normally sits at the very end of the file.
A correctly defined facet region looks like this:
<flexiPageRegions>
<itemInstances>
...
</itemInstances>
<name>Facet-da8e7260-6ff6-4fa0-8a96-d83e5b77c391</name>
<type>Facet</type>
</flexiPageRegions>
If the <type> line is missing, that makes the region go straight from <name> to </flexiPageRegions>, and is the root cause for Salesforce failing the validation with this error.
In the cases we've seen, the XML file in the source Git branch had lost the <type> line, while the same Lightning page in the target org still had it. Example:
This can happen when a FlexiPage file is changed outside of Salesforce, for example when changes are rolled back, a commit is reverted, or a merge conflict is resolved manually in a large FlexiPage file.
Note: The line number in the error refers to the file as it was packaged for the validation. It may not exactly match the line numbers you see in the Gearset comparison, especially with the Simplify differences option enabled. Use it as a rough pointer rather than an exact location.
Resolution
Below we're explaining how to find the missing element and resolve the error depending on how you're making your deployment in Gearset.
Find the missing <type> element
Open the comparison for your failed validation and select the FlexiPage component named in the error.
Switch to the XML view of the component and look through the differences between the source and the target. Look for a
<flexiPageRegions>block that has a<name>but no<type>on the source side, while the target side shows a<type>line (for example<type>Facet</type>) highlighted as a difference.Step through all the differences on the component, not only the first one. If more than one region is missing its
<type>, you need to fix each one, otherwise the validation will fail again with the same error at a different line.Also, check the end of the file to confirm the page's top-level
<type>is present.
Workaround for failed PR validation in Gearset Pipeline
To resolve the error when a pull request in your Gearset Pipeline fails the validation:
In the feature branch from which your PR was created, add the missing
<type>element back into the affected<flexiPageRegions>block, directly after the region's<name>line. You can do this by editing the FlexiPage XML file directly in your Version Control System (e.g GitHub).Alternatively, if the Lightning page in your development org is correct, re-commit the FlexiPage from that org into the feature branch. In your Gearset Pipeline, you can do it by selecting the Dev Sandbox from which the feature was created, and then selecting
Commit more changes...option.
Note: Make sure to commit changes to the correct feature branch.Once the fix is committed, re-validate the PR in your pipeline.
Guidelines on how to add more changes to an existing feature branch can be found in this article: Promoting your first features.
Workaround for deployments made via Compare and deploy
These troubleshooting steps are mainly for scenarios where you're not working with Gearset Pipelines.
Does the error happen when running a validation via Compare and deploy (e.g. Git to org, or org to org)?
For Git to org deployments
Add the missing
<type>element back into the FlexiPage XML file in the branch you're deploying from, or use Compare and deploy to commit the correct version of the Lightning page from an org into that branch.Refresh the comparison, then validate against the target org again.
For org to org deployments
Refresh the comparison so that Gearset retrieves the latest version of the Lightning page from the source org, then re-validate.
If the error persists, open the Lightning page in Lightning App Builder in the source org, save it, and then refresh the comparison and validate again.
If the validation still fails, download the deployment package with Download package on the pre-deployment summary page (see our guidance on how to change the deployment package before deploying).
Note: If a validation stage was successful and the deployment has already failed with this error, you can also download the package from Deployment history page.
Unzip the package and open the FlexiPage XML from the
flexipagesfolder.Add the missing
<type>element after the region’s<name>line, and repeat this for every affected region.Re-zip the package, keeping the original folder structure.
In Compare and deploy, select Local files as the source, then choose Zip and use Upload zip.
Compare against the original target org and validate the FlexiPage.
Disclaimer: This error is returned by Salesforce directly, rather than Gearset. Even so, we offer guidance based on our combined experience with the Metadata API. Where possible, we try to help guide you to fix or avoid this error. In the case that this isn't possible, we may need to direct you to Salesforce support for further clarification.


