by Njål

Problems with Recycle Bin in Umbraco – No Document exists with Version '00000000-0000-0000-0000-000000000000'

I recently had some problams emptying the Recycle Bin in Umbraco 4.6.1.  I clicked Empty Recycle Bin – but after a few items got removed the progress suddenly stopped showing 201 items remaining. Crap.

Internet Explorer displayed a Javascript Error msg (with a stacktrace):

No Document exists with Version '00000000-0000-0000-0000-000000000000'

Waiting, restarting IIS and trying to empty the recycle bin again did not help. Time to Google.

I found part of the solution here:

The sql

SELECT * FROM umbracoNode, cmsContent -- return nodes
WHERE
nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' -- that are of type 'Content'
AND
umbracoNode.id NOT IN (SELECT nodeId FROM cmsContent) -- but are not in the 'Content' table

helped me identidy orphan nodes that should be removed.

For each unique umbracoNode.Id in the result (you will get a lot of rows with the same id using the sql above) i ran the sql below to remove these nodes.

DECLARE @TEMPID INT
SET @TEMPID= 1843 -- TYPE IN ID HERE - e.g. 1843

DELETE
FROM         cmsContent
WHERE     (nodeId IN (Select id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         cmsPropertyData
WHERE     (contentNodeId IN (Select Id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         umbracoNode
WHERE     (id IN (Select id from umbracoNode where parentID = @TEMPID))

DELETE
FROM         umbracoNode
WHERE     (ID = @TEMPID)

Then I tried emptying the recycle bin again. Now it deleted 10 more items before it stopped.

I repeated the steps above again – first I ran the select sql to find the new orphan nodes, and then I ran the delete sql’s. I was able to remove 43 more items from the recycle bin this way.

I repeated this procedure until my Recycle Bin was empty (I had to do it 6-7 times or so).

Make sure to backup your database before trying this approach.

  • http://www.prolificnotion.co.uk/ Simon Dingley

    Thanks for posting this solution – it worked for me!

  • http://www.comm-it.be Damiaan

    Oh yeah! Thanks for posting! Feels a bit creapy to edit directly on the database but works like a charm!
    I put the select after the deletes. Like that you can update the ID to delete with the next in your select list (launched directly after removal of the previous).

  • Nick

    Word of caution. After doing this, courier went absolutely mental.
    What happens now is

    a) Courier packages hundreds of irrelevant files than the ones that we are couriering (even if couriering just one file)

    b) On the target it randomly assigns different parent IDs to random nodes accross the site, completely unrelated to the ones we are couriering. As a result these nodes disappear from the content tree