When Deploying anything from VSCode I get the same error everytime. I have created a new project in VSCode using SFDX.

I am able to authorize and retrieve from org, but anytime I deploy I get the same error:

TypeError: Cannot read property 'success' of undefined

when running from VS Code context menu


ERROR running force:source:deploy:  Cannot read property 'success' of undefined

when running from CLI


  • this happens regardless of if it is from vs code context menu or the CLI
  • this is in brand new apex classes that have been generated and nothing added and also ones with actual code (meaning its not code errors)
  • I have tried: creating a new project, reinstalling java, reinstalling the extension pack. All had the same result.

EDIT: Issue ended up being that I was connecting to a Production Environment instead of a dev sandbox! You can't directly deploy to Proe, so I just had to swap the org. Thanks for the help all!

  • Best way to go about getting to the bottom of this is to open an issue in github.com/forcedotcom/cli
    – identigral
    Oct 13, 2020 at 20:28
  • Do you have the latest version of the CLI? "sfdx update" should get you the latest version...Also try running this command from your project's root folder... where the sfdx-project.json file is located.
    – Rodrigo
    Oct 13, 2020 at 22:15

8 Answers 8


Just had the same error and I found the root cause: when Apex class .cls and .cls-meta.xml file names do not match, CLI push will fail with that error.

I've logged a bug here: https://github.com/forcedotcom/cli/issues/674


This is now fixed with CLI version 7.76.1 and salesforcedx plugin version 50.1.1

  • @WesC did that solve your question? If yes, can you mark my answer as accepted.
    – POZ
    Nov 16, 2020 at 13:42

This is fixed in the latest release CLI version 7.76.1 salesforcedx plugin version 50.1.1

Run this below command:

sfdx update

sfdx plugins:install salesforcedx@latest


I had this problem just now in VS while trying to deploy. It also popped up in a CI pipeline that failed the other day. I did ran 'sfdx update' as Rodrigo indicated, this unfortunately did not work.

What fixed it for me was I [re] Authorized an Org to my sandbox environment. Once the authorization was successful, the deployment worked and I no longer received the

TypeError: Cannot read property 'success' of undefined

I hope that works for you as well. The error message lacks any meaning to me. Perhaps it has to do with the token expiring or Username/Credentials may have changed.


Some devs mention that updating the Salesforce CLI solves it:

sfdx update
sfdx plugins:install salesforcedx@latest

I have been struggling with this all day. I finally got it working. I recreated the project from scratch, but when I did I chose the standard project template. Then it started working.

In the past all my projects have worked fine, never had any trouble. It was just the new project I created today that kept failing time after time. Its the only one I ever created using the blank template in VS code, all the other I have chosen standard in the past.

I hope this helps.



What I noticed when this happened to me was that I had committed my new Apex class but I hadn't committed my .cls-meta.xml file so when I switched branches and pushed to my class to our full sandbox, I got that same error.

To remedy this, I just went to my other branch and cloned that .cls-meta.xml file to my new branch and THEN pushed my Apex class (and its corresponding xml file) into our org.

Hopefully that works for your situation too!


1- Uninstall Salesforce CLI

2- Go to windows explorer and use this path "%LOCALAPPDATA%\sfdx"

3- Delete all the files from there

4- Reinstall Salesforce CLI


I encountered this issue and I found that I mistakenly delete the apex class but its meta data file was present...So either remove the metadata apex file or include both files.

Hope it will help!!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .