Uninstalling a managed package in Salesforce sometimes fails with an error referencing a sharing rule that can't be found - even though the sharing rule doesn't appear anywhere in the Salesforce UI. This happens because Salesforce can leave behind sharing rule metadata that's no longer visible or editable through the standard interface, but still blocks the uninstall process. Tools like the Metadata API and the ANT Migration Tool can surface and remove this hidden metadata.
UI (User Interface) - the standard Salesforce interface used for day-to-day configuration.
Metadata API - the API used to deploy and retrieve configuration changes, including metadata not visible in the UI.
ANT Migration Tool - a Java/Apache Ant-based command-line tool used to deploy and retrieve metadata via the Metadata API.
Users see an error message like the one below when uninstalling a managed package, even though the referenced sharing rule cannot be found in the UI:
SBQQ__Quote__c.xxxxxxxxxxxxxx Entity of type 'SharingOwnerRule' named 'SBQQ__Quote__c.xxxxxxxxxxx' cannot be found
There are two reasons this can occur:
The package and/or package license has expired.
The sharing rule is invalid and therefore does not appear in the UI.
This article explains how to resolve an uninstall error caused by a hidden or invalid sharing rule left behind by a managed package in Salesforce, using the Metadata API to find and remove it.
Ensure the package is in an active state and the associated licenses are active.
Use metadata retrieve to get the info on invalid sharing rules. For example, you can use the ANT Migration Tool to deploy/retrieve metadata.
Use the destructive change Metadata API deployment process to remove the invalid sharing rules.
Try to uninstall the package again.
000974908

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.