"Item Clone Promote failed" error when a clone and its copy are published together​


Description

Publishing might fail with an unhandled exception when a clone and its copy are processed in one batch. For example:

This results in the following error in the log records:

[Error] Item Clone Promote from "Master" to "Internet" failed. - Error: "An item with the same key has already been added."
[Error] An error occured running an operation on Manifest 0fca1f76-7758-42cf-b2b7-33d33610c74a, sourceStore "Internet". - Error: "An item with the same key has already been added."
[Error] One or more targets were not succesfully promoted.
System.AggregateException: One or more targets were not succesfully promoted.  The failed target(s) are: Manifest=0fca1f76-7758-42cf-b2b7-33d33610c74a Target=8e080626-ddc3-4ef4-a1d1-f0be4a200254.
 See inner exceptions for details. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
   at Sitecore.Framework.Publishing.DataPromotion.DefaultItemCloneManifestPromoter.<>c__DisplayClass4_0.<<Promote>b__0>d.MoveNext()
...
This issue affects Sitecore Publishing Service 2.2 Update-1 - 3.1 Update-2, and 4.0.0.

Solution

To resolve the issue, download and install the patch compatible with the affected product version found on the following page:
https://github.com/SitecoreSupport/Sitecore.Support.40913/releases

To get a solution for other releases, contact Sitecore Support.