Deployment error – The AppMenu called ‘AppSwitcher’ is standard and cannot be deleted on pushing to scratch org

appdeploymentsalesforcedxscratch-org

I am trying to do a simple push of my vscode to my scratch org using sfdx force:source:push -u [email protected] and I run into this error

Type Project Path Problem
Error force-app\main\default\appMenus\AppSwitcher.appMenu-meta.xml The AppMenu called 'AppSwitcher' is standard and cannot be deleted

In my directory, I don't have the appMenus folder at all. I can't figure out why this problem is showing up and what does the error message actually mean

DirectoryScreenshot

Best Answer

Sometimes there's quirks with the standard metadata types - it's expecting it to be in your source as every org has two AppMenu files (AppSwitcher.appMenu & Salesforce1.appMenu). Since it's not there, it seems it attempts to delete it (which isn't possible).

You'll either want to do one of the following

  • Retrieve the AppMenu metadata from your source org into your repository
  • Exclude AppMenu in your .forceignore file for source commands so it ignores this metadata type in CLI source commands.

I'd recommend ignoring it as it doesn't add any value in your source - there's issues deploying it as such to re-order app menu items and users can easily customize the order of apps that display in the app launcher in Lightning anyway.

enter image description here

You can see an example of this being done in the lwc-recipes repository for certain standard metadata which includes appMenus

# Standard metadata
package.xml
**/appMenus/**
**/appSwitcher/**
**/objectTranslations/**
**/profiles/**
**/settings/**

# LWC configuration files
**/jsconfig.json
**/.eslintrc.json

# LWC Jest
**/__tests__/**