I have a custom SharePoint 2010 Timer Job that had been running fine. The job performs processing on 88 sites in our web application. One day, everything was working fine. The next day, the 72nd site started throwing the following error:

The Execute method of job definition MyNamespace.Administration.RequestJobDefinition threw an exception. More information is included below. Object reference not set to an instance of an object.

Exception stack trace: at Microsoft.SharePoint.SPSite.PreinitializeServer(SPRequest request) at Microsoft.SharePoint.SPWeb.InitializeSPRequest() at Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName) at Microsoft.SharePoint.SPListCollection.GetListByName(String strListName, Boolean bThrowException) at MyNamespace.MyJobs.MyJobBase.Process(SPSite site) at MyNamespace.MyJobs.MyJobBase.Process(Guid id) at MyNamespace.MyJobs.MyJobBase.Process(List`1 siteIDs) at MyNamespace.Administration.RequestJobDefinition.Execute(Guid targetInstanceId) at Microsoft.SharePoint.Administration.SPTimerJobInvokeInternal.Invoke(SPJobDefinition jd, Guid targetInstanceId, Boolean isTimerService, Int32& result)

Here is the code that is failing:

protected virtual bool Process(SPSite site)
    bool proceed = true;
    SPList list = site.RootWeb.Lists.TryGetList("My Messages");
    if (list != null)
        proceed = Process(list);
    return proceed;

The error is happening on TryGetList, which is strange because not only does the list exist, but that method is not supposed to return an exception.

I have not had any recent deployments. But even in the latest deployments, the above code has not changed in well over a year.

What could be going wrong?

  • The obvious place to look - which you did not mention - is in the list itself. Has it changed in any way(columns, name, settings. etc)? Commented Oct 2, 2014 at 15:42
  • Are you sure that both site and site.RootWeb are not null at that point? Commented Oct 2, 2014 at 15:57
  • You were both on the right track. It wasn't the list or the site, but rather the content database that had changed. Thanks. Commented Oct 2, 2014 at 16:28

1 Answer 1


I was able to fix the problem by clearing the Configuration Cache.

Turns out the content database for this site collection was in a group that was recently migrated to another server. And while the others sites continued to work after the migration, the cache for this site must have become corrupted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.