Tried to run this command:

sfdx force:source:convert -r ./ -d mdapioutput

from my project root, and got this error:

The package root directory is not a source directory

  • 1
    Just want to note that the same exception is thrown if you mistakenly run sfdx force:source:convert from the wrong directory. If you don't immediately realize this, it can be very opaque to debug. Apr 9, 2020 at 16:09

2 Answers 2


I ran into the same problem, when I wanted to create a temporary (git cloned) copy and use this copy to be wrapped and deployed. I always got the error, even for the cloned force-app directory.

You fix this, when you add a second entry in the packageDirectories inside the sfdx-project.json file

  "packageDirectories": [
      "path": "force-app",
      "default": true
      "path": "temp-deployment/force-app",
      "default": false

I did not stick with this approach, but this way you can have two source directories and select one of them.


It's intuitive to run this command from the project root, but what this command does is look inside your sfdx-project.json file, and the default value there points to the force-app directory.

So the command that will work is:

sfdx force:source:convert -r ./force-app/ -d mdapioutput

For more info, see: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ws_convert_mdapi.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .