Handle exception in agent when node was removed and rediscovered

Change-Id: Icb9bb4282d00b83de44477f9063292a76c444c4c
Closes-Bug: #1349815