KNOWLEDGE BASE

No Document Exists With Version Umbraco Error and Orphan Revisions


We came across a strange issue while publishing pages in Umbraco, each time we viewed the pages, we were getting the following error:

"No Document exists with Version xxxxxx"

Although there may be other causes of this error, we found our problem were entries in Umbraco's cmsContentVersion table, which did not have a corresponding entry in the cmsDocument table.  This created an orphaned revision which was causing the error.

Luckily, you can easily identify orphan revisions with the following SQL query:

SELECT * FROM cmsContentVersion
WHERE
cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND
cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)

Once you are happy and can confirm these are the revisions that need to be deleted, you can go ahead and delete them with:

DELETE FROM cmsContentVersion
WHERE
cmsContentVersion.VersionId NOT IN (SELECT VersionId FROM cmsDocument) AND
cmsContentVersion.ContentId IN (SELECT nodeId FROM cmsDocument)

This is very quick to run and sorted out our problem instantly. It should be noted that there are other causes of this error, and it's worth investigating using the SELECT SQL Query first before making any updates.


Need an Umbraco Master?

Here at Simon Antony, we have an in house certified Umbraco Grand Master available for hire. Got a problem with your site, need architecture advice, give us a call to speak to Simon directly and see how we can help

Contact Simon Today!