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!