Content Deployment Error (stsadm –o export)

Recently I wanted to copy a subweb to a new site collection, so it will there be the rootweb. How can the web be moved? stsadm export is your friend. At least I thought…

Error: Specified cast is not valid.
   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAsByteArray(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob)
   at Microsoft.SharePoint.Library.SPRequest.GetFileAsByteArray(String bstrUrl,String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob)
   at Microsoft.SharePoint.Deployment.AttachmentsSerializer.GetDataFromDataSet(Object obj, SerializationInfo info, StreamingContext context)
FatalError: Specified cast is not valid.
   at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAsByteArray(String bstrUrl, String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob)
   at Microsoft.SharePoint.Library.SPRequest.GetFileAsByteArray(String bstrUrl,String bstrWebRelativeUrl, Boolean bHonorLevel, Byte iLevel, OpenBinaryFlags grfob)
   at Microsoft.SharePoint.Deployment.AttachmentsSerializer.GetDataFromDataSet(Object obj, SerializationInfo info, StreamingContext context)
   at Microsoft.SharePoint.Deployment.AttachmentsSerializer.GetObjectData(Object obj, SerializationInfo info, StreamingContext context)
   at Microsoft.SharePoint.Deployment.XmlFormatter.SerializeObject(Object obj, ISerializationSurrogate surrogate, String elementName, Boolean bNeedEnvelope)
   at Microsoft.SharePoint.Deployment.XmlFormatter.WriteArray(Object array, String name, Type objectType)
   at Microsoft.SharePoint.Deployment.XmlFormatter.SerializeObject(Object obj, ISerializationSurrogate surrogate, String elementName, Boolean bNeedEnvelope)
   at Microsoft.SharePoint.Deployment.XmlFormatter.Serialize(Stream serializationStream, Object topLevelObject)
   at Microsoft.SharePoint.Deployment.ObjectSerializer.Serialize(DeploymentObject deployObject, Stream serializationStream)
   at Microsoft.SharePoint.Deployment.SPExport.SerializeObjects()
   at Microsoft.SharePoint.Deployment.SPExport.Run()

Hmm. That does not look as if the export succeeded.

In the line above the Error, I could see that an attachment (which was a zip with 4 gifs) was the last object that was accessed. I could open the attachment. No problem. So what could be the problem with this particular zip file? I could not find something. So I disabled the virus scanner. And voilà, the export ran without an error.

Conclusion

If you have problems exporting content, disable the virus scanner in your central administration prior to running stsadm.