I'm trying to import data in a scratch org but I'm always getting the error

andresbrav-ltm2:sfdx-out local.user$ sfdx force:data:tree:import --targetusername test-user@example.com --plan export-demo-Broker__c-Property__c-plan.json 
ERROR running force:data:tree:import:  ENOENT: no such file or directory, open '/Users/local.user/.local/share/sfdx/client/node_modules/salesforce-alm/schemas/dataImportPlanSchema.json'

I have generated the json data files and the json plan file with the sfdx export command, I have tried also with the files from the git repository for the trailhead course DreamHouse but it always tries to find this file .../dataImportPlanSchema.json that is not the plan file I'm sending.

Did anyone face this issue and know how to make the import command work with a plan to insert related tables?.

  • 1
    There's been a rash of random errors lately. Have you tried the following commands: sfdx update and sfdx plugins:install salesforcedx@latest? – sfdcfox Mar 29 at 9:50
  • There has been a new release of the CLI so it is possibly a version error. Best to try updating as @sfdcfox suggests. – Dave Humm Mar 29 at 9:54
  • 2
    Thank you @sfdcfox, the command: sfdx update and sfdx plugins:install salesforcedx@latest did the magic – andres.bravo Mar 29 at 9:59
  • @sfdcfox Thank you very much! It helped me too in a bit different situation! – Mariia Illarionova Mar 29 at 10:45
  • Had the same issue and doing "sfdx update and sfdx plugins:install salesforcedx@latest" killed my CLI... ERROR running force:org:create: Cannot read property 'create' of undefined – Robert Sösemann Mar 29 at 18:59

This was a bug in 45.8.1. We fixed this in a patch, 45.8.2. https://developer.salesforce.com/media/salesforce-cli/releasenotes.html

Also, you do not need to run sfdx plugins:install salesforcedx@latest as the latest version of salesforcedx is already bundled with the cli. Just sfdx update is enough. I would recommend uninstalling salesforcedx as a user plugin and just using the one bundled with the CLI. To do so, just run sfdx plugins:uninstall salesforcedx. You only need to install it as a user plugin to pin to a specific version that isn't latest, see https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm# for more info.

To verify you are using the core salesforcedx version, you can run sfdx plugins --core and you will see the (core) next to salesforcedx.

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.