Log error message if memory context is invalid