Wondering if someone can help me with this. I'm trying to delete some components with the migration tool (Ant).

However when I try to deploy, I'm getting the following error:

    *********** DEPLOYMENT FAILED ***********
Request ID: 0Af2400000stDKJCA2

All Component Failures:
1.  package.xml -- Error: Bad file:Unexpected element {http://soap.sforce.com/2006/04/metadata}members during simple type deserialization

*********** DEPLOYMENT FAILED ***********

Total time: 2 seconds

Here is package.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

This is the sample package.xml for undeploying code that comes bundled with the Migration Tool.

Here is destructiveChanges.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">

Both files are in the same directory.

I also get the same error message when deploying the same files with the Dev. Workbench:

workbench error

Now if I remove this line from package.xml:


I still get the same error.

Can anyone shed some light on what I'm doing wrong here?

  • do you have both files in same directory. because error system no package.xml found – Himanshu Nov 4 '15 at 18:18
  • update this question with your destructiveChanges.xml +package.xml – Himanshu Nov 4 '15 at 18:23
  • I've added destructiveChanges.xml to my post, package.xml was already there. Both files are indeed in the same directory. – Davin Casey Nov 4 '15 at 18:40
  • I feel its some version conflict ..Can you change your ANT version and also keep package.xml and destructive with same version. – Mohith Shrivastava Nov 4 '15 at 20:26
  • Ant & Migration tool are the latest versions, all XML files are on API V35. Tried with V33, same result. – Davin Casey Nov 4 '15 at 21:33

Sorry if you find this overKill (This will retrieve all items from your org and remove them)

The way i have gotten mine to work (This is for a full dev operation and will be overkill if you know all the information needed, However if you do not know all of the data by name this will work. It will just take some time to run) is with a several stage deploy undeploy check, First i generate a package.xml for all items within a org. using the wildcard *

Here is what mine looks like (CUT DOWN VERSION) (Package.xml)

<echo file="purge/package.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
            <Package xmlns="http://soap.sforce.com/2006/04/metadata">

then you will want to replace the package definition like so

 <replace file="purge/package.xml">

Now you will want to re-deploy the wildcard package definition

        pollWaitMillis="1000" />

Next you will want to retrieve by name (This will give you your explicit package definition, You can skip all the above if you have this information already)

    pollWaitMillis="1000" />

You can trash all local components retrieved from this.

<delete includeEmptyDirs="true" dir="purge" includes="**/*" excludes="*.xml" />
        <copy file="purge/package.xml" tofile="purge/destructiveChanges.xml" />
        <echo file="purge/package.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
            <Package xmlns="http://soap.sforce.com/2006/04/metadata">

Now you can deploy your explicate deploy over the top of the org. This will delete everything.

    pollWaitMillis="10000" />

The above will get you removing all items from the org, You can write in ignore rules if you wish.

To me you above error of members is referencing your Package.XML where you have not told it about any Members Or Types. I would add


just to rule that out. But this will get you running.


Have you tried removing the codepkg line from package.xml?

According to the Migration Tool Guide:

To deploy the destructive changes, you must also have a package.xml file that lists no components to deploy, includes the API version, and is in the same directory as destructiveChanges.xml:

<?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/2006/04/metadata"> <version>34.0</version> </Package>

  • Yes, even when removing this line I still get the same error. – Davin Casey Nov 5 '15 at 8:59

I'm getting the same error even though destructivechanges+package.xml and build.xml are in different directories. ll Component Failures: 1. package.xml -- Error: Bad file:Unexpected element {http://soap.sforce.com/2006/04/metadata}members during simple type deserialization

*********** DEPLOYMENT FAILED ***********

    at com.salesforce.ant.DeployTask.logFailedDeploy(DeployTask.java:178)
    at com.salesforce.ant.DeployTask.handleResponse(DeployTask.java:150)
    at com.salesforce.ant.SFDCMDAPIAntTaskRunner.runTask(SFDCMDAPIAntTaskRunner.java:92)
    at com.salesforce.ant.DeployTask.execute(DeployTask.java:63)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
    at org.apache.tools.ant.Main.runBuild(Main.java:857)
    at org.apache.tools.ant.Main.startAnt(Main.java:236)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:287)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:113)

Can someone please help.

Best Regards Anand


Thanks for all your input guys, much appreciated.

It turns out that the problem was that package.xml & destructiveChanges.xml were located in the same directory as build.xml.

Quite a bizarre one, but as soon as I moved package.xml & destructiveChanges.xml to their own directory and pointed the undeploy target to this directory the deployment successfully deleted the components listed in destructiveChanges.xml.

Marking this post as the answer in order to close off the question, thanks again for all the help.

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.