Cannot delete profile error in Salesforce DX

The fact that you do not have profiles in your local machine suggests to DX that you are trying to delete the profile from the server.

In SalesforceDX the local source superceedes the server source.

If you want to skip the profile files from being pushed to the scratch org, I would suggest to do the following:

  1. Bring back the profile folder and the profile file as it was. One way to get this back is to run sfdx force:source:pull --forceoverwrite
  2. Exclude the Admin.profile by adding it to the .forceignore file in your root of the project (create one if necessary) and add the path to the profile(s) to exclude the file(s).

For example, below is what your .forceignore file would contain for the "Admin" profile:

<appName>/main/default/profiles/Admin.profile
<appName>/main/default/profiles/Admin.profile-meta.xml

Here <appName> is your application folder name.


You don't have to re-pull the profiles folder after deleting it.

I just added this line to my .forceignore and that stopped the error from happening (I also do not require any other profile):

force-app\main\default\profiles\**

Tags:

Salesforcedx