"Media request analytics failed" error in the logs


Description

The following message might be found in the logs:

ERROR Media request analytics failed
Exception: System.ArgumentNullException
Message: Tracker.Current.Session.Interaction is not initialized.
Parameter name: Tracker
Source: Sitecore.Framework.Conditions
   at Sitecore.Framework.Conditions.RequiresValidator`1.ThrowExceptionCore(String condition, String additionalMessage, ConstraintViolationType type)
   at Sitecore.Framework.Conditions.Throw.ValueShouldNotBeNull[T](ConditionValidator`1 validator, String conditionDescription)
   at Sitecore.Framework.Conditions.ValidatorExtensions.IsNotNull[T](ConditionValidator`1 validator, String conditionDescription)
   at Sitecore.Analytics.RobotDetection.Media.MediaRequestEventHandler.OnMediaRequest(Object sender, EventArgs args)

The issue appears when a visitor identified as a robot accesses a media item.

Solution

To resolve the issue, consider one of the following options: