When you deploy a profile that includes the packaging2promoteversion permission, you may see this error:
This article explains why it happens and how to fix it.
Error overview
This error occurs when Dev Hub is enabled in your Production org and the packaging2promoteversion is assigned on a profile.
If Production and Main are in sync, then this permission will be present on new feature branches if they are cut from Main.
When deploying through your Gearset Pipeline, if the target orgs of your CI jobs are not Dev Hubs, you are likely to encounter this error.
Resolution
Check to see if the permission is in any profiles in Main branch in your version control (e.g. GitHub, Azure DevOps etc). You'll need to remove this permission from Main and any branches it has found it's way into.
Once it has been removed from the feature branch via a commit, the promotion branch in Gearset should update with the change and thus should rerun the validation. This operation would allow you to clear this error.
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.

