For Salesforce DX, after downloading code from an Unmanaged Package to push to a Scratch Org, when I try to convert the unzipped package I am getting an error saying that

Unexpected file found in package directory: .../package.xml.

I "retrieve" the code from an Unmanaged Packaged in a Sandbox org into a top level directory of my Salesforce DX project called "mdapipkg". I have added this as a path in the sfdx-project.json file. Upon the "convert" command, specifying this directory, I get this error.

I do not understand why it is telling me that the package.xml is unexpected, as it is a typical part of the downloadable zip from an Unmanaged Package.

Has anybody come across this issue?

2 Answers 2


I came across the solution reading this post: https://developer.salesforce.com/blogs/developer-relations/2017/07/migrating-existing-projects-salesforce-dx.html.

Apparently you cannot delete the .zip before you convert the files. You have to do it after.

  • Fwiw, I ran into this problem and it doesn't appear that the order of deletion of the zip affected things. For me, the problem seemed to be that I was trying to run the convert from a place other than the project root. Dec 19, 2017 at 7:05

In my case the problem was with project's configuration file: sfdx-project.json and packageDirectories attribute.

It looked like this:

  "packageDirectories": [
      "path": "force-app",
      "default": true
    {"path": "mdapipkg"}
  "namespace": "",
  "sfdcLoginUrl": "https://test.salesforce.com",
  "sourceApiVersion": "42.0"

I added mdapipkg directory to packageDirectories because I thought it will help me with some sfdx force:mdapi commands but it didn't and caused such problems. It was first complaining about package.xml than about unpackaged.zip file. Once I removed that folder from sfdx-project.json convert command did the work!

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.