Recently I had problems with a site I have created using umbraco. The problem was that for some reason in the version control of the application there were many orphan versions that where visible on the cmsContentVersion table but not on the cmsDocument. You can find those using the query below:
SELECT * FROM cmsContentVersion WHERE cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)
Deleting those record fixed my problem and the problematic nodes where shown again in both the content tree view and edit view in umbraco CMS. To delete those versions in your database use the code below:
DELETE FROM cmsContentVersion WHERE cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)
Thank you for this fix.
works like a charm! probably saved me lot of work to find the problem.
thanks!
Thank you very much! I was looking for a fix for few hours and yours worked !
I have used this fix several times now. Thanks 🙂
Thanks. This got me out of a hole. In my particular case I also had to delete from the cmsPreviewXML table too based on the above query….
DELETE FROM cmsPreviewXML WHERE versionID IN (
SELECT VersionId FROM cmsContentVersion
WHERE
cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND
cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument))
Not entirely sure why the node got messed up.
But what is the problem, why does this happen, I’m not confident deleting random records from my Umbraco when this problem arises?
Thanks, this fixed my issue today. Cheers.
@hsj I am with you, we have a number of Umbraco environments and only one is exhibiting this issue.
Need a better understanding what the problem is and what causes it then get the devs to fix it.
Running delete on a live database without understanding the true impact is not acceptable.
Umbraco keeps track of all the changes made on every node in the content so that it has history and it is possible to revert to a previous version. So every time you save a node from the content or publish it does not change the old record what it does is create a new one with all the data again. Now in case something goes wrong while saving or publishing there are some cases that the new version is created in the database but the coresponding data has not been saved. This leaves you with this error since when umbraco tries to retrieve the latest version of the document that record does not exist!
Awesome, thanks!
Thanks.. You saved my time 🙂
The issue showed up in some of my environments after calling PublishWithSubs(…) in code.
PublishWithChildrenWithResult(…) does the trick.
Seems to me that the api is a big mess 🙁
PS: Thank you for the hint, saved me a lot of time! 😉
Worked like a charm!
Thanks a lot, worked like a charm! 🙂
Beware, for this to work in MySQL, use all-uppercase:
SELECT * FROM CMSCONTENTVERSION
WHERE
CMSCONTENTVERSION.VERSIONID NOT IN (SELECT VERSIONID FROM CMSDOCUMENT) AND
CMSCONTENTVERSION.CONTENTID IN (SELECT NODEID FROM CMSDOCUMENT)
Perfect, thank you!
Hiya! This is the third time visiting now and I just wanted to say I truley fancy looking at your website. I have decided to bookmark it at stumbleupon.com with your title: and your Web address: . I hope this is all right with you, I’m making an attempt to give your excellent blog a bit more exposure. Be back shortly.
Of course its OK! Thank you… 🙂
spyriadi,
Your post saved me hours in a jam on a large production site. Thank you very much. In my case, there was one problematic top-level node that appeared unpublished (i.e. the starburst icon showed over a top level date folder) I looked up all activity on that node, using this query:
select COUNT(*) as NumberOfEvents, logHeader, userId from umbracoLog
join umbracoUser UU on
umbracoLog.userId = UU.id
where NodeId = ‘15293’
group by userId, logHeader order by NumberOfEvents desc
Note that one of the users had 463 publishes on a date folder node. Not sure why someone would keep trying to publish a date folder over and over again, but after reading your comment to drmemal above, I do see a connection. Thanks!
Awesome! I just had the same issue and you saved me a bunch of time. Thanks for sharing your wisdom!