What to do in case of starting sfdx: retrieve source from org unknown exception?

1.6K    Asked by dipesh_9001 in Salesforce , Asked on May 2, 2023

I am getting this when I retrieve code from my Org. I was able to authorize an org successfully, but when I go to the Org Browser and try to pull in data of a custom object that is when I get this error SFDX: Retrieve Source from Org failed to run

I saw a post suggesting to reinstall Salesforce CLI. I tried but it didn't work for me.

Please advice, I am behind on my work because of this.

This is what I see on my terminal when I right click and run retrieve from org

Answered by Camellia Kleiber

In case of starting sfdx: retrieve source from org unknown exception, check to make sure your versions match your org version API version in VisualStudio.

Open - https://.my.salesforce.com/services/wsdl/metadata
The header comment will show your API version:
Salesforce.com Metadata API version ##.0
In Visual Studio check the following file values -
sfdx-project.json and check sourceApiVersion value.
Package.xml check ##.#

You may need to restart VisualStudio after making these changes. Additionally, I've had to go to CLI and revert to a prior version. Most recently I had to revert from 56.5.1 to 55.4.1. To change the CLI version go to Extension VS code >> Search for Salesforce CLI Integration >> near the Uninstall button there is a drop-down >> Install another version.



Your Answer

Answer (1)

If you encounter the "SFDX: Retrieve Source from Org Unknown Exception" error while attempting to retrieve metadata from a Salesforce org using Salesforce CLI (SFDX), there are several steps you can take to troubleshoot and resolve the issue:


Check Connection: Ensure that you're connected to the correct Salesforce org by running the sfdx force:org:list command. Verify that the org you're attempting to retrieve metadata from is listed and that you're authenticated to it.

Verify Permissions: Make sure that the user authenticated to the Salesforce org has the necessary permissions to retrieve metadata. Depending on your org's configuration, you may need specific permissions or feature licenses to retrieve certain types of metadata.

Review Project Configuration: Check your SFDX project configuration (sfdx-project.json) to ensure that it's correctly configured with the right target org and package directories. Make any necessary adjustments to ensure that the retrieve operation targets the correct metadata components.

Update Salesforce CLI: Ensure that you're using the latest version of Salesforce CLI. You can update Salesforce CLI by running the command sfdx update.

Retry the Retrieve Operation: Sometimes, transient issues or network connectivity problems can cause the "Unknown Exception" error. Retry the retrieve operation using the sfdx force:source:retrieve command and see if the issue persists.

Check Salesforce Status: Verify the status of the Salesforce service by checking the Salesforce Trust Status (https://status.salesforce.com/). If there are any known service disruptions or maintenance activities, wait until they're resolved before attempting the retrieve operation again.

Review Error Details: If the error message provides additional details or error codes, review them for clues about the underlying issue. Sometimes, error messages can provide specific information that can help pinpoint the problem.

Contact Support: If you're unable to resolve the issue on your own, consider reaching out to Salesforce support or consulting the Salesforce developer community for assistance. Provide relevant details about the error and steps you've taken to troubleshoot it.

By following these steps and troubleshooting the "SFDX: Retrieve Source from Org Unknown Exception" error, you should be able to identify and address the underlying issue preventing you from retrieving metadata from your Salesforce org.

6 Months

Interviews

Parent Categories