Search Crawl error: Value does not fall within the expected range

Been facing an issue where the Search Service is not crawling a simple site collection in our SharePoint farm. Had a scratch through the crawl logs and found the following error:

The SharePoint item being crawled returned an error when requesting data from the web service. (The item was deleted because it was either not found or the crawler was denied access to it.
– Error from SharePoint site: Value does not fall within the expected range.)

This is caused by orphaned users in your site collection database. When SharePoint syncs with AD the deleted accounts\profiles are not always cleaned up properly by SharePoint. Not going into user profile sync in this post, so just jump next to solution:

Run the following update script on your site collection content db (if you are scared of the dark or believe in backups then maybe run as a select first):

Update UserInfo set tp_deleted=tp_ID where tp_SiteID=’42461088-3f26-4c2d-937e-c630c7033307′ and tp_Login in
Select tp_login from UserInfo where tp_SiteID=’42461088-3f26-4c2d-937e-c630c7033307′ and len(ltrim(rtrim(tp_systemid))) <25 and tp_deleted = 0
and tp_login not in (‘NT AUTHORITY\authenticated users’, ‘NT AUTHORITY\LOCAL SERVICE’,’SHAREPOINT\system’)

Essentially we are just disabling the orphaned users (excluding the system accounts). Rerun your crawl now and all should be fine

Leave a Reply

Your email address will not be published. Required fields are marked *