Sitecore.ContentSearch.SitecoreItemCrawler.IsAncestorOf(Item item) Error

In this article


You see this message in your Sitecore logs :

6048 22:49:54 ERROR Application error.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.ContentSearch
at Sitecore.ContentSearch.SitecoreItemCrawler.IsAncestorOf(Item item)
at Sitecore.ContentSearch.SitecoreItemCrawler.IsExcludedFromIndex(SitecoreIndexableItem indexable, Boolean checkLocation)
at Sitecore.ContentSearch.Pipelines.GetContextIndex.FetchIndex.<>c\_\_DisplayClass9.<GetContextIndex>b\_\_3(<>f\_\_AnonymousType1\`2 <>h\_\_TransparentIdentifier0)

In addition, http://<INSTANCE_HOSTNAME>/coveo/rest is returning 500 errors all of a sudden.


This error can occur if a new index/crawler is added to the web.config and if the root of that item is only in the master database (that is, it’s not yet published in the web database). This is also true if a crawler root is modified to an item that isn’t yet in the web database.

The reason is that when Sitecore tries to fetch the index for an item, it lists all the crawlers and filters out the ones that aren’t supposed to crawl the item. The method is fragile as it doesn’t do null checks. Sitecore seems aware of the issues in that method and has provided a workaround as we can see in StackOverflow (see links below).


You need to fix the new component that you introduced. Follow the links below for more details on how to do so.