We are receiving a deployment error saying that:

Component Failures:

  1. classes/OneOfOurClasses.cls-meta.xml -- Error: Must specify both the source file & the metadata file

We are using git and Jenkins to deploy all of our code to different orgs.

Why is this occurring, and how can we fix this?

1 Answer 1


This occurs when you delete a Class file, but fail to delete the -meta.xml sidecar file that goes along with it. If that -meta.xml file remains in your /src directory when you are attempting to deploy (for example) all classes to a server, then you will get this error. The solution is to make sure that if you delete a file you also delete it's -meta.xml file. The best way to do this is to delete the file on the server or (if using Mavensmate) by using the Mavensmate > Delete From Server menu option.

Keep in mind that just deleting a file from the collection of files you are deploying will not delete that file in other orgs. To do that you need to include the file you want to delete in a destructiveChangesPre.xml or destructiveChangesPost.xml file.

  • Same deal for deploys as well. You have send the meta file with the Apex Class/Component/Trigger/Page file to prevent such errors.
    – Sridhar
    Jul 29, 2015 at 21:31

You must log in to answer this question.

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