I am getting this error while trying to fetch(retrieve) source from VS Code and SF Extension Pack.
STR :
Right click on sfdx-project-json -> click on Retreiev Source from Org.
The file is present in the directory. So the problem doesn’t exist here.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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).
Method 2
While retrieving using sfdx:force:source:retrieve --manifest <path of Package.xml>
was getting InvalidPackageDirectory error.
Steps:
- Go to Package.xml file
- 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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0