To avoid duplication issues you should set a unique reference no for each queue item when it is added using add queue item
It is unique for every queue item so the duplicates data will not be entered
I think what i understands about second query is regarding the retry mechanism of queue item
First to make queue item retry , we should set autoretry as Yes with retry number value >0
Like whnever when some application or system exception occurs in workflow while executing the process we should update queue status as Failed along with reasons like Business Exception or Application Exception using set transactional status activity in UiPath. In case of Business Exception bot will not retry that queue item as there is no mean of retrying it again (because that error occured some error in data which cannot be rectified via retrying again and again). So when system exception occurs the queue status will updated as Retry due to Application exception and add a queue item of same type again and process it (it will retry upto max retry no for queue which user / developer has defined)