Retrieve command on developer org throwing error “ERROR running force:source:retrieve: Cannot read property 'record' of undefined”
Repository to reproduce:
Metadata retrieved
ERROR running force:source:retrieve: Cannot read property 'record' of undefined
SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.71.0-4193fb4acc win32-x64 node-v12.18.3
SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)
@oclif/plugin-autocomplete 0.1.5 (core)
@oclif/plugin-commands 1.3.0 (core)
@oclif/plugin-help 3.1.0 (core)
@oclif/plugin-not-found 1.2.4 (core)
@oclif/plugin-plugins 1.9.0 (core)
@oclif/plugin-update 1.3.10 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.2.1 (core)
analytics 1.12.0 (core)
generator 1.1.3 (core)
salesforcedx 49.7.0 (core)
├─ salesforcedx-templates 49.4.0 (core)
├─ custom-metadata 1.0.8 (core)
├─ salesforce-alm 49.7.0 (core)
└─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core)
sfdx-cli 7.71.0 (core)
OS and version:
Windows 10 Home || Version 2004 || Build 19041.450
I am using salesforce extension pack 49.6.0 and facing the same issue.

I downgraded my sfdx cli and it is working for me.
sfdx plugins:install [email protected]
I downgraded my sfdx cli and it is working for me.
sfdx plugins:install [email protected]
Hi karthik, I tried this solution but its still not working. Is there any specific way to do this / or specific way to execute this command ?
Same problem here in various environments. Downgrading worked - sfdx plugins:install [email protected]
I work with with both 'normal' Sandbox environments and scratch orgs. Pushing to Sandbox environments worked fine, but was receiving the "Cannot read property 'record' of undefined" error on both pulls & pushes to scratch orgs.
Downgraded using "sfdx plugins:install [email protected]" and scratch org pushes / pulls now work.
Started seeing this error/problem today; downgrading to 49.2.3 worked for me.
Also getting this error. This is a big problem.
A partial workaround is to right-click on the "classes" and "triggers" node in the VS Code project and click "retrieve" in the context menu, but I believe this does not retrieve any new classes or triggers - it just retrieves the ones that already exist in the folder.
Seems to be looking for sfdx-project.json in the wrong place - in the home directory. Temporarily copying a sfdx-project.json (not a great idea) to the home directory does not seem to help.
Workaround
Wrap the retrieve manifest path with double quotes and execute the command in the terminal tab.
E.g
-> sfdx force:source:retrieve --manifest "c:\projects\git\folder\manifest\manifest.xml"
That CLI command-line does work. Thank you.
To confirm the problem,
sfdx force:source:retrieve --manifest "c:\projects\git\folder\manifest\manifest.xml"sfdx force:source:retrieve --manifest c:\projects\git\folder\manifest\manifest.xml@shetzel - the first 2 command-line workarounds work (the 2nd if there are no spaces in the path to the XML manifest file).
The 3rd bullet describes the problem quite well - right-clicking on a manifest xml in a VS Code project no longer works. Instead of working, one gets "ERROR running force:source:retrieve: Cannot read property 'record' of undefined".
Thanks.
@CarlParmenterCLDPartners - thank you! I'll transfer this issue to the VS Code repo.
I have the same issue, but not with retrieving through a manifest, but through the org browser.
It is thrown when I try to retrieve a single class or all the apex classes through the node in the org browser by clicking the 'cloud-arrow' icon.
It throws the exact same error as mentioned above. When I run the generated command (sfdx force:source:retrieve -m ApexClass) in the terminal window, the classes are retrieved without any problem.
This is due to npm library resolution finding an old version of the analytics plugin for some reason. The fix is coming in next week's patch release. You can try:
sfdx update. This might not fix it but definitely worth trying.This issue happens also in simple trailhead Create a Hello World Lightning Web Component with the same error.
Took me over a week to see the resolutions here, @karthikhibiz Thank You for your help!
Wish this error bug is posted in Trailhead!
I have this error when running
sfdx force:package:version:create
My package only has one Object, which I can push without a problem with the mdapi.
My sfdx version is 7.71.0

The error persists in version 7.72.0
Downgrading to 7.69.0 fixed my problem
This issue seems to surface if there is a space used in the path to the package.xml. So sfdx force:source:retrieve --manifest c:\Data\ProjectA (abc)\manifest\package.xml will get this issue BUT sfdx force:source:retrieve --manifest "c:\Data\ProjectA (abc)\manifest\package.xml" will work.
Downgraded to 49.2.3 and problem went away
Just writting to confirm this bug in yet another setup. Downgrade worked aswell.
Experiencing this on sfdx-cli/7.72.0 also.
sfdx force:source:retrieve -m CustomObject:XXXXXX_c
It seems to be working fine now on: sfdx-cli/7.73.2-feef087df8 win32-x64 node-v12.18.3
Today the issue re-surfaced when working on another project. When I started working on the project this morning all was fine, after an hour of so, downloading some metadata through the org-browser, it started throwing this error again. I updated the CLI to sfdx-cli/7.73.2-feef087df8 win32-x64 node-v12.18.3 and the error went away :-)
Based on reports, it seems like this no longer happens in the latest versions of the CLI. Please reopen if this starts to happen again.
Most helpful comment
I downgraded my sfdx cli and it is working for me.
sfdx plugins:install [email protected]