Empty client-side error appears in the Upload Media dialog


Description

Uploading the same media file two times in the Upload Media dialog of the Content Editor might result in an empty client-side error and the following error in the log records:

Exception: Sitecore.Exceptions.DuplicateItemNameException
Message: The item name "your_image" is already defined on this level.
Source: Sitecore.Kernel
at Sitecore.Data.Items.ItemUtil.AssertDuplicateItemName(Item destinationItem, Item sourceItem, String name)
at Sitecore.Data.Items.ItemUtil.AssertItemName(Item destinationItem, Item sourceItem, String name)
at Sitecore.Data.Items.Item.Add(String name, TemplateID templateID)
at Sitecore.Resources.Media.MediaCreator.CreateItem(String itemPath, String filePath, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaCreator.AttachStreamToMediaItem(Stream stream, String itemPath, String fileName, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaCreator.CreateFromStream(Stream stream, String filePath, MediaCreatorOptions options)
at Sitecore.Resources.Media.MediaUploader.UploadToDatabase(List`1 list)
at Sitecore.Resources.Media.MediaUploader.Upload()
at Sitecore.Pipelines.Upload.Save.Process(UploadArgs args)

The issue appears when uploading a file with the name which already exists in the same folder and it does not happen with admin user.

 

Solution

Consider the following solutions: