Error overview
You may run into this validation error when deploying changes to SearchSettings metadata type.
For example, on below screenshot we're seeing:
"Entity is null or entity element's name is null"
Explanation of the error
This error indicates that SearchSettings metadata in its XML file refers to an object that either doesn't exist or is not accessible in the target org. Salesforce calls an object "an entity".
The SearchSettings metadata defines which objects are searchable and how they behave in search results.
Based on that understanding, it's possible that one or more objects listed in SearchSettings metadata aren't present in the target org to which you're deploying.
In below example, when we checked the comparison of the failing pull request in Gearset Pipelines, we learned that SearchSettings metadata (which is referred to as Settings) was referencing an object (ActiveScratchOrg) which was not present in the target org.
This can be easily confirmed by searching for the object name in the Search bar (top right corner), which would surface the same object as a new component in comparison results.
Resolution
If you've come across this error during PR (pull request) validation in your Gearset Pipelines, consider below workarounds which should help you address the issue.
Workaround 1
Note: This workaround considers deploying the missing objects to the target org. If these objects aren't required or shouldn't be present in the org, please refer to workaround 2 instead.
Similarly as on the above example (see screenshots), once you have identified the object(s) which are showing up as new in your source environment (e.g. on a feature branch > org comparison), consider the following steps:
1) If you're working with Gearset Pipelines, deploy the missing object(s) to the target org as part of a "New feature" (PR).
2) Consider deploying each object individually by committing every object to a brand new feature branch, and then in your Gearset Pipeline open a new PR against the environment that represents your target org (e.g. INT/UAT/QA etc).
3) Once all missing objects are successfully deployed to the target org, try to re-validate the original PR that failed the validation for SearchSettings. The expectation here is that the validation succeeds this time.
Workaround 2
Note: This should apply only if the missing objects are not to be deployed to the target org. Please note that you should verify and confirm beforehand that the missing objects aren't required or shouldn't be present in the target org (double check with the Release Manager if needed).
Once you've confirmed which object(s) the SearchSettings metadata is referencing, and verified which of these objects are not present in the target org, consider the following steps:
1) In the XML file find <searchSettingsByObject> block where the <name> tag references the object(s) that are not present in the target org.
2) Then remove these lines of code from your feature branch. You're looking at removing an entire reference to the object which should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<SearchSettings xmlns="http://soap.sforce.com/2006/04/metadata">
<searchSettingsByObject>
<searchSettingsByObject>
<enhancedLookupEnabled>true</enhancedLookupEnabled>
<lookupAutoCompleteEnabled>true</lookupAutoCompleteEnabled>
<name>ActivateScratchOrg</name>
<resultsPerPageCount>25</resultsPerPageCount>
</searchSettingsByObject>
...
</SearchSettings>
3) Once the feature branch is updated, try to re-validate your original PR in the Pipeline.
Tip: If you're not sure which object is causing the error, you can use a process of elimination. Remove half of the <searchSettingsByObject> entries (or only one entry with a specific object), and try to re-validate the PR.
If PR validation succeeds, that means the bad entry was in the half you removed. If it fails, then bad entry is present in the half of code you kept. Repeat this process until you isolate the single problematic entry (object).
Resolution for deployments made via Compare and deploy
If you're using our Compare and deploy tool to push the SearchSetting and have run into this error, you can still apply both of the above workarounds - except that you wouldn't be making deployments in the Pipeline, but instead:
For workaround 1, you would be using "Compare and deploy" to deploy the missing objects to the target org.
While for workaround 2, you'd need to consider downloading your deployment package from Gearset, amending it locally (e.g. in an XML edited such as VC Code), re-pack it as .zip file again, and then using the amended .zip package as the source of your deployment. Instructions on how to do this are in this documentation: How can I change the deployment package before deploying?
Other possible root causes
The root cause of this error is usually a mismatch in object availability between the source and target orgs. This includes:
Missing Custom objects
TheSearchSettingsfile lists a Custom object (e.g.,My_Custom_Object__c) that has not been deployed to the target org, or the Salesforce user making a deployment doesn't have permission to see the object.Disabled Standard objects
The file references a standard object that is not enabled or available in the target org. Common examples include:KnowledgeArticleVersion(if Knowledge is not enabled)QuestionorReply(if Chatter Questions is not enabled)LiveChatTranscript(if Live Agent is not configured)
Missing managed package objects
The settings reference an object that is part of a managed package, but that package is not installed (or is a different version) in the target org than in the source.Renamed or deleted objects
An object that was once searchable in the source org has been deleted or renamed, but theSearchSettingsfile was not updated to reflect this change.
Useful resources
More information on this error can be found on Salesforce StackExchange forum.
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.



