I am getting this error while trying to fetch(retrieve) source from VS Code and SF Extension Pack.


Right click on sfdx-project-json -> click on Retreiev Source from Org.

enter image description here

The file is present in the directory. So the problem doesn't exist here.


The problem is that your sfdx-project.json file isn't a source file that can be retrieved. You'll need to select something valid to retrieve.

This can be a particular metadata file (e.g., a specific class file to retrieve just that class), a folder (e.g., the classes folder to retrieve all classes in the folder) or a manifest (package.xml file).

  • 1
    Hey John, Actually the situation is that I need to fetch all customObjects using VS Code and I added the entry of Custom Object in package.xml and tried again to retrieve data by right clicking on sfdx-project.json and clicking retrieve source and there I get error. Is there a way to retrieve the custom objects in that project
    – rrc1709
    Jan 2 '19 at 12:49
  • 3
    For that, you should right-click on the package.xml file and click 'Retrieve Source from Org' to retrieve the metadata in your manifest. If you want to retrieve all of your custom objects and nothing else in the manifest you could also run the following command: sfdx force:source:retrieve -m CustomObject Jan 2 '19 at 12:59

While retrieving using sfdx:force:source:retrieve --manifest <path of Package.xml> was getting InvalidPackageDirectory error.


  1. Go to Package.xml file
  2. Right-click on this file and select "Retrieve Source in Manifest from Org.

Resolution: From sfdx-project.json file removed unnecessary path. My sfdx-project.json looks like this.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.