Can not find user
Detection
- RegExp:
Error (.*) Cannot find a user that matches any of the following usernames
Examples
Error Shared_Reports Cannot find a user that matches any of the following usernames: john.doe@acme.com.dev; remove the user from the component and try deploying again.
Resolution
{1} names users that do not exist in the target org: usernames are not the same in each org (sandbox suffix).
- Share with public groups or roles instead of named users -> https://help.salesforce.com/s/articleView?id=sf.creating_and_editing_groups.htm&type=5
- Or add a text replacement rule that writes the username of each org before each deployment (https://sfdx-hardis.cloudity.com/salesforce-devops-config-replacement-rules/)
- Or remove the XML part referring to the usernames
Example of XML you have to remove in {1}:
<folderShares>
<accessLevel>Manage</accessLevel>
<sharedTo>nicolas.vuillamy@hardis-scratch-po-tgci-root-develop_20220412_0604.com</sharedTo>
<sharedToType>User</sharedToType>
</folderShares>