Stefan Goßner

Senior Escalation Engineer for SharePoint (WSS, SPS, MOSS, SP2010) and MCMS

Common Error: The site is not valid. The 'Pages' document library is missing.

Common Error: The site is not valid. The 'Pages' document library is missing.

  • Comments 33
  • Likes

In the past I had a couple of cases where users received the following error message:

The site is not valid. The 'Pages' document library is missing.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.SharePoint.Publishing.InvalidPublishingWebException: The site is not valid. The 'Pages' document library is missing.

The interesting piece here is that the Pages library indeed existed but could not be found.

Background Information

To understand this we need to look into how the Publishing feature find the Pages library in a Publishing site. As the Pages library does not need to have the name "Pages" - e.g. in German version it has the name "Seiten" SharePoint does not search for the Pages library by name.

Instead the Publishing feature stores the unique ID of the Pages library in the __PagesListId property which resides in the property bag of the publishing site.

The above listed error will occur if the value stored in the __PagesListId does not match the ID of the actual Pages library.

What can cause this problem?

Honestly: I don't know. I have not managed to forcefully cause such an inconsistency - if one of you has repro steps, please post a comment here!

How to fix the problem?

To fix the issue it is required to update the value of the __PagesListId property value to match the ID of the Pages library.

This can be done (e.g.) through the following Powershell script:

$web = get-spweb http://site-collection/path-to-affected-site
$correctId = $web.Lists["Pages"].ID
$web.AllProperties["__PagesListId"] = $correctId.ToString()
$web.Update()

 

Comments
  • I've seen this issue caused by turning off and on the publishing feature.

  • Hi Stefan Goßner,

    Did you mode Webs or publishing pages between webs?

  • Hi Mike,

    I tried that as well - but in my tests this did not lead to an inconsistency.

    Did you do anything specific in addition?

    Cheers,

    Stefan

  • Hi André,

    moving of sites should not be able to cause such problems as it only changes the Url property of the SPWeb object.

    Moving a page is actually an export/import of the page - and that will also not update a property of an SPWeb object.

    Cheers,

    Stefan

  • Hi Stefan,

    We had this problem a few months ago, but I forget the exact sequence of events. I could replicate it at the time, I think by switching off the publishing  feature on a sub-site, then on the site collection. Then turning it on for the site collection and then the sub-site.

    We didn't find a fix, and because of a deadline we just restored a backup.

  • Hi Mike,

    thanks for the hint!

    I tried your repro steps on my box but I cannot reproduce the problem.

    If you manage to find the exact repro steps please post them here.

    Cheers,

    Stefan

  • Hi Stefan, i know about the url Path reference to page layout  problem that also exist in 2007, but if you make the move of that page with the correction of the url  the field "__PagesListId" is not updated to the Pages folder.

  • This happen to me once when i migrate Publishing page between Webs in SharePoint 2010, after migrate and update the publishing reference to page layout, have the same error as yours, so after migrate needed to update this 2 field the page folder "__PagesListId" and Page layout url reference, in 2007 use blog.falchionconsulting.com/.../fix-publishing-pages-page-layout-url now change in the metadata list.

  • Hi André,

    thanks for the info.

    If I remember right that was related to combining backup/restore between farms (or renaming servers) and export/import.

    That was fixed long ago and people use the unsupported STSADM extension command to mangle with the links of the page layouts.

    Would be interesting to know if all affected users used this stsadm extension.

    Cheers,

    Stefan

  • Hi Stefan!

    I tried enable/disable of the feature from both the site collection and web site levels with no luck.

    I thne tried your code and BAM! it worked.

    Thanks for the fix.

  • Hi Peter,

    thanks for letting me know hat it helped!

    :-)

    Cheers,

    Stefan

  • Hi Stefan,

    this issue I faced with some sites and while deactivating and activating the publishing feature -is publisher causing the issue ?

    the script helped big time - thanks

    Gaadda

  • Hi Gaadda,

    I still don't have a repro for this.

    If you can share the steps then I can test.

    Cheers,

    Stefan

  • Hi Stefan,

    I have this same problem currently on one of my subsites. We had problems with publishing that I corrected at the Top Level site... but the subsites are still getting this error.

    Do I have to run this script at the top level? and will it trickle down to all subsites?

    Thanks!

    Martin

  • Hi Martin, this fix has to be done on each affected site (SPWeb object). You cannot fix it in one place for the whole site collection.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment