"Object reference not set to an instance of an object." when running stsadm backup or enumsites

I ran across this strange error while trying to backup a site collection

I noticed that while running automated SharePoint backups that a certain site collection was not being backed up.  This was a site collection one level down from the root site collection.  For example, if the root site was http://mySharePoint, this was a sub-site collection (sub-SC): http://mySharePoint/sites/subSiteCollection (this was running MOSS 2007 Enterprise).


I logged on to the machine and ran the script in a command prompt and it worked fine, it just skipped over the sub-SC.  This got me thinking as to why this was happening, as the script is supposed to enumerate down through all site collections.  First I tried to run a manual backup by running:


stsadm -o backup -url http://mySharePoint/sites/subSiteCollection -filename \\backups\subSC.bak


And it gave me the error:


Object reference not set to an instance of an object.


I then tried to enumerate through the sites:


stsadm -o enumsites -url http://mySharePoint


And all of the other sub site collections showed up fine, but I got this error:


<Sites Count="2">

  <Site Url="http://mySharePoint" Owner="DOMAIN\naspinski" SecondaryOwner="DOMAIN\stan" ContentDatabase="WSS_Content_Root" StorageUsedMB="500" StorageWarningMB="0" StorageMaxMB="0" />

  <Site Error="Object reference not set to an instance of an object." />


As you can see, the first site shows up, but it is followed by the vague error message where the second site report should be.  This is an incredibly non-descript SharePoint error that leaves you scratching your head.  I knew the site collection was there; I could navigate to it, I could find it in my Central Administration and everything worked fine.  I was able to back up other site collections and everything, just not this one.


Turns out after scouring the internet and checking every setting I could find without any help at all, I fell back on one of my List of 5 Simple SharePoint 2007 Fixes (which I should have done first) and number two on the list fixed it.  I ran SharePoint Technologies and Configuration Wizard and magically the problem had stopped.  Once again, not sure exactly why SharePoint did what it did, but this seemed to work out.

Comments are closed