Path Analyzer Missing Data and Instead of That I've Got a Handful of Entitydoesnotexistexception Exceptions

A new client came to me asking about their Path Analyzer missing random days of data. EntityDoesNotExistException gives some easy answers, but a less known trick finally fixed this issue.

When asked to look at an issue, the first thing I did was to replicate the issue and check the logs. In fact, when checking Path Analyzer, there's entire days missing from the history of the site. At least I know what to look at when confirming fixes were effective. Checking the logs are the next thing to do, and there's quite a lot of exceptions like this were found:

ERROR Exception when executing agent pathAnalyzer/mapRebuildStatusCheckerAgent 
Exception: Sitecore.Analytics.Core.Data.EntityDoesNotExistException
Message: Routine caused exception: Processing_GetTaskById.

The conventional fix for EntityDoesNotExistException is to ensure all maps are properly deployed. This is done in a couple of simple steps.

Re-Deploy All Maps

Part of the admin tools suite is the Path Analyzer page, found at /sitecore/admin/pathanalyzer.aspx. Here, you can see if there are maps that have not yet been deployed, which can be a common fix for this issue.


Deploy any maps that need it by either the individual map:

Or the batch, deploy all maps at the bottom of your maps list:

Now that the maps are deployed I'll use the Historic Map Rebuild function on the same page. Now, be prepared to get a few coffees, because this process can take a long time.

All Good, but the Errors Are Creeping Back!

The missing data is reappearing, so I'm about to go and boast I've got my fix, but there's a problem. The EntityDoesNotExistException is starting to show up in the logs again, but all maps are deployed, the history is rebuilt, and everything looks healthy. 

After checking the reporting database, I see that the TreeDefinitions table has TaskId values set but there are no running tasks under this context. The issue is, when the maps were deployed there is a bug, where task ids are not reset if there's a connection issue to the database. This has since been fixed in version 10.1 of Sitecore and higher, but for now the following command will correct the issue.

Update [dbo].[TreeDefinitions] SET TaskId = '00000000-0000-0000-0000-000000000000' WHERE Status = 3

The exceptions stopped permanently as soon as this was executed, and I'm off to shout from the rooftops that I made someone's day!