An item with the same key has already been added
I was trying to re-publish some images, which i have unpublished earlier but end up getting the error mention in the title. Now, whenever I try to access Content>>Images, I will get have a popup with this error. The rest of the cms seems to be working ok.
Hi,
You have the same problem as that : News Problems .
It's a regression on Q1 SP2. If you unpublished and re-published a content without modification you break referential integrity in database because there are no foreign keys....
You have to go in database and try to suppress the faulty line.
Regards,
Nicolas
Hi Nicolas,
Do you happen to know which table do I look into for Images?
Thank you in advance?
Hi,
it's the datatable [sf_media_content].
Regards,
Nicolas
Hi JingYuan Lin,
We know of an issue as the one you described and have logged a bug. The problem was introduced in 1501 ( it is fixed in our latest
internal build ) when you unpublish an image, and publish it again.
Can you
still access the following page:
http://yourwebsite/sitefinity/Content/Images/Albums
If you access to that page, you can try to delete all libraries and add the
files again. This should fix the issue.
Best wishes,
Victor Velev
the Telerik team
Thank you Both Nicolas and Telerik Admin.
If I dont wish to delete all the libraries, which is the 'Key' I should look for?
Hi,
you have to find your image who cause the bug. If you have the name is more easy. Otherwise you have to check duplicate keys for the same image into datatable.
Regards,
Nicolas
Could a unique index be applied to the table to prevent this from happening in the future?
HI,
Is this issue fixed in 4.1 sp3 ?
This is in the sp3 notes, is it the same issue?
"Content/Pages: fixed error appearing when published item is unpublished and then published again"
IF so, will the code cope with the duplicate data now in the database?
Or will we need to run a cleanup script on the table? Do you have a script...?
We've just struck this in our production system so keen to know asap.
Thanks,
Justin
Hello Justin,
The issue is fixed in the SP we released ( 4.1 SP3 ). You may upgrade your project to it because it also contains performance and security fixes and updates.
Regards,
Victor Velev
the Telerik team
We have the same problem but we must repair project now.
The upgrade take many times and problems.
There is a procedure to fix error in database immediatly?
We have identified the news item in database, we must delete it to repair backend news page?
Thanks
Hi,
You have to delete only one line in database.
On your identified news, check [original_content_id] who are duplicate (different of 00000000-0000-0000-0000-000000000000).
You have two lines one with [visible] equals 0 and other equals 1, get the [content_id] on the line with [visible]=0 .
Delete it from [sf_news_items_sf_permissions] :
DELETE
FROM
[MyDB].[dbo].[sf_news_items_sf_permissions]
WHERE
[content_id]=
'xxxxxx-xxxxxxxx-xxx-xxxx-xxxxxxx'
DELETE
FROM
[MyDB
].[dbo].[sf_news_items]
WHERE
[content_id]=
'xxxxx-xxxxxxxx-xxxxxxx-xxxxxx-xxxxx'