While deploying code by ANT, i am receiving following error for all Static Resources:

  1. staticresources/myResource.resource-meta.xml -- Error: Required field is missing: content

Could this be related to API Version? Never got this kind of error in earlier deployments.

Following is the xml file content:

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

5 Answers 5


hey guys i was facing same problem when i tried deploying the staticresources. and i solved with adding blank content tag as following :

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

and it worked for me. hope this will help you.


When you deploy your static resources from ANT tool you need to send .xml file also in below format for every static resource :

  1. If static resource is of type zip:

<?xml version="1.0" encoding="UTF-8"?> <StaticResource xmlns="http://soap.sforce.com/2006/04/metadata"> <cacheControl>Public</cacheControl> <contentType>application/octet-stream</contentType> </StaticResource>

  1. If static resource of type any other then:

<?xml version="1.0" encoding="UTF-8"?> <StaticResource xmlns="http://soap.sforce.com/2006/04/metadata"> <cacheControl>Private</cacheControl> <contentType>application/javascript</contentType> </StaticResource>

Here content type is the type of the file

Hope this will help you :)

Ask me if you need any more help

  • The error comes because of xml file, and the sample code in the question contains the properties cacheControl and contentType. Not sure whats missing..
    – ipradhansk
    Jan 27, 2016 at 10:53
  • @SanTosh Any clue for the issue, you were facing. I am facing similar issue.
    – sakura
    Jun 18, 2016 at 11:44

Make sure your directory structure and filenames are right. This is what worked for me:

package.xml in the main directory:

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

The zip needs to be called my_archive.resource not .zip and needs to be in the staticresources directory.

Then you need to have a file staticresources/my_archive.resource-meta.xml with the following content:

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

With all this, ant deploy should work. This is not obvious at all and it's really hard to find in official docs.

To point to a file from your zip, in a VisualForce page, use something like:

<img src="{!URLFOR($Resource.my_archive, 'my_image.png')}"/>

This error Required field is missing: content generally come when content file is missing in the folder. So when ever we deploy any content on salesforce and we have only meta.xml file not the actual content file then need to make sure that we have created the respective content file.

Like for staticresorces -> .resource file, Apex class -> .cls file, Visualforce page -> .page file etc.

Example : Error: staticresources/myResource.resource-meta.xml(myResource):Required field is missing: content

Then your content file "myResource.resource" is missing in staticresources folder. Create the file named as "myResource.resource".

Then again start the build.

This worked for me. Hope this will help you.


Also, the template and accompanying metadata filenames are case sensitive, so in pcv's answer the files my_archive.resource and my_archive.resource-meta.xml are correctly the same case. For example, using the filename My_Archive.resource-meta.xml will result in the 'content' missing error.

You must log in to answer this question.

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