function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shreya TripathiShreya Tripathi 

SFDX: Retrieve Source from Org failed to run

Hi,

I am trying to retreive source from my org but keep getting the error-SFDX: Retrieve Source from Org failed to run.
I have tried-
updating the salesforce cli extension and also salesforce extension to the latest - v 50.17.0  I have updated the salesforce CLI to latest version- 7.85
still getting the error. Plus when i use the latest version i get additional error-
Error running command sfdx.force.source.retrieve.component: Running the contributed command: 'sfdx.force.source.retrieve.component' failed.. This is likely caused by the extension that contributes sfdx.force.source.retrieve.component.

I tried downgrading the extension to version 49.2 still getting the error- SFDX: Retrieve Source from Org failed to run.

message in output -
name": "UnexpectedFileFound",
  "message": "Unexpected file found in package directory: \\main\\default\\surveySettings\\Survey.survey-meta.xml",
  "exitCode": 1,
VinayVinay (Salesforce Developers) 
Hi Shreya,

The issue might be because of latest CLI version.  Can you try using sfdx.source ?

Check below reference:

https://github.com/forcedotcom/cli/issues/811

Hope this helps....

Thanks,
Shreya TripathiShreya Tripathi
I tried downgrading the cli version to 49.2 and 49.13 but that also didn't work. Still getting the same error.
RichardWoodRichardWood
If you navigate to the folder and delete it, you should be able to retrieve it normally. Note: this applies only specifically to that surveySettings folder.

This appears to be an issue with an older version of the Salesforce CLI creating the folder in the wrong place, and then newer versions of the CLI (with that error fixed) don't know what to do with it.
Louis Monterosa 9Louis Monterosa 9
I was able to fix this by going to my work production environment and copying the manifest folder content of package.xml, then copy paste the xml from that file into my trailhead dev org 
 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>ApexClass</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexComponent</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexPage</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTestSuite</name>
    </types>
    <types>
        <members>*</members>
        <name>ApexTrigger</name>
    </types>
    <types>
        <members>*</members>
        <name>AuraDefinitionBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>LightningComponentBundle</name>
    </types>
    <types>
        <members>*</members>
        <name>StaticResource</name>
    </types>
    <version>48.0</version>
</Package>

 
Louis Monterosa 9Louis Monterosa 9
Just to clarify the above, I created the manifest folder and then the package.xml file within the folder locally. Then proceeded to paste the above contents to the file. Finally right clicked on the package.xml file "SFDX: Retrieve Source in Manifest from Org" and viola it worked. 
Christian KaselChristian Kasel
Louis Monterosa has the solution that worked from me. I just had to get the manifest/package.xml file with the above code (my version is 52.0), but the key is to right click and retreive from source ON the package.xml file. I would pull from the default folder where all the files were, but you need to pull from the .xml file. Hope this helps!
Nazrul AminNazrul Amin
23/09 - Finally managed to download the source code onto my VS Code Editor..seems I had to specifically use the Retrieve Source Command from the Package.xml file, not the Package.json file...