Fix broken Hub Sites in SharePoint Online

If you have been an early adopter of the Hub Site functionality ( in SharePoint Online, you might also get stuck in some trouble with Hub Sites not showing up in SharePoint Admin Center or being unable to register or unregister these sites. Fortunately it is quite easy to clean up broken hub sites and get back on track.

Example of error message from PowerShell registering a hub site (Register-SPOHubSite):

The list item could not be added or updated because duplicate values were found in the following field(s) om the list: [HubSite, Site]

So it tells us something like there is already an registered hub site for that URL but thing are messed up and now it doesn't work. Usually you run into these issues right before launching a new intranet or other portals for you company, so this can be a bit stressful.

Solution: Clean up old hub sites

Using the PnP PowerShell module as an SharePoint administrator run this:

Connect-PnPOnline -Url
Get-PnPListItem -List HubSites

You will get a result like this:

Id    Title                                              GUID
--    -----                                              ----
6     Intranet                                           e1a88177-fe1a-4c32-9109-d4ada14469b8
7     Finance                                            a862d25f-56db-48e3-9641-7313fac36855
8     Operations                                         b584407b-aebd-499f-9ee7-f3f864574ca6

Remove the Hub Site(s) that doesn't work like this (change "Identity" with the correct value):

Remove-PnPListItem -List HubSites -Identity 8 -Recycle

You might get an access denied, this needs to be fixed by assigning yourself as a site collection administrator using the SharePoint Online PowerShell module:

Connect-SPOService -Url
Set-SPOUser -Site -IsSiteCollectionAdmin:$true -LoginName


By cleaning up the hidden list "HubSites" with PowerShell you should be able to get your Hub Sites back on track. Note that is is recommended from Microsoft to wait 24 hours before re-registering a broken Hub Site to allow the system to clean up and be able to get it right the next time.