Rajesh
Rajesh 👨🏻‍💻developer, architect, consultant focussed on modernization, cognitive services, and conversational ai.

The site is not valid. The 'Pages' document library is missing.

The site is not valid. The 'Pages' document library is missing.

Error

I got a mail from one of our users, complaining they are not able to access the quick launch in their site and also getting the below error message when accessed navigation from the site settings.
The site is not valid. The ‘Pages’ document library is missing. Most of you might be seeing an error occurred screen with a correlation ID.

Fix

After checking with the user, came to know that user tried to deactivate and activate the publishing feature in the site to fix some issue, and it started after this. This is very common error, and found so many articles explaining how it needs to be fixed. Most of them are suggesting that the __PagesListId does not match the ID of the actual Pages library, where __PagesListId is a property in site property bag collection.

Running the below PowerShell script fixes the issue, you need to change the site url in line 01. The script is actually looks for the pages library in the site for which url is given and assigns the ID of the pages library to the __PagesListId property.

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

Everything is fine, what if you don’t have an access to the server to run the script. If you have site owner access alone then you can follow the below steps to fix.

The site is not valid. The 'Pages' document library is missing.

  • Click on Add to add property. Enter __PagesListId as property name and the list id copied in previous step as the value. If the property already exists, just change the value to current pages library Id.

The site is not valid. The 'Pages' document library is missing.

Go ahead and refresh the screen, the error should be gone.

comments powered by Disqus