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.
- Login to the site as owner and go the page library settings
- Copy the list id alone from the browser url, which looks like below
- http://siteurl/_layouts/listedit.aspx?List=ea2e4d1c-f9f9-4cc7-b2ef-a8b9035dcb43
- Open the site in the SharePoint designer
- Click on site options
- 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.
Go ahead and refresh the screen, the error should be gone.