Page MenuHomePhabricator

Error when loading the bookmark button for users not connected to CentralAuth
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT

Description

What happens?:

This happens in my local environment with CentralAuth extension enabled and a local account not connected to CentralAuth.

  • there is an error when trying to load any page that can have the reading list bookmark button, as ReadingLists are tied to a central user id and are not specific to any particular wiki.
Original exception: [55a465d923208fefe7e0e439] /wiki/Main_Page?debug=1 MediaWiki\Extension\ReadingLists\ReadingListRepositoryException: This method cannot be called without specifying the user. (readinglists-db-error-user-required)
Backtrace:
from /var/www/html/w/extensions/ReadingLists/src/ReadingListRepository.php(1047)
#0 /var/www/html/w/extensions/ReadingLists/src/ReadingListRepository.php(200): MediaWiki\Extension\ReadingLists\ReadingListRepository->assertUser()
#1 /var/www/html/w/extensions/ReadingLists/src/HookHandler.php(145): MediaWiki\Extension\ReadingLists\ReadingListRepository->getDefaultListIdForUser()
#2 /var/www/html/w/extensions/ReadingLists/src/HookHandler.php(78): MediaWiki\Extension\ReadingLists\HookHandler::getDefaultReadingListUrl()
#3 /var/www/html/w/includes/HookContainer/HookContainer.php(141): MediaWiki\Extension\ReadingLists\HookHandler->onSkinTemplateNavigation__Universal()
#4 /var/www/html/w/includes/HookContainer/HookRunner.php(4092): MediaWiki\HookContainer\HookContainer->run()
#5 /var/www/html/w/includes/skins/SkinTemplate.php(972): MediaWiki\HookContainer\HookRunner->onSkinTemplateNavigation__Universal()
#6 /var/www/html/w/skins/Vector/includes/SkinVector22.php(53): MediaWiki\Skin\SkinTemplate->runOnSkinTemplateNavigationHooks()
#7 /var/www/html/w/includes/skins/SkinTemplate.php(1375): MediaWiki\Skins\Vector\SkinVector22->runOnSkinTemplateNavigationHooks()
#8 /var/www/html/w/includes/skins/SkinTemplate.php(599): MediaWiki\Skin\SkinTemplate->buildContentNavigationUrlsInternal()
#9 /var/www/html/w/includes/skins/SkinTemplate.php(180): MediaWiki\Skin\SkinTemplate->getPortletsTemplateData()
#10 /var/www/html/w/includes/skins/SkinMustache.php(117): MediaWiki\Skin\SkinTemplate->getTemplateData()
#11 /var/www/html/w/skins/Vector/includes/SkinVector22.php(304): MediaWiki\Skin\SkinMustache->getTemplateData()
#12 /var/www/html/w/includes/skins/SkinMustache.php(79): MediaWiki\Skins\Vector\SkinVector22->getTemplateData()
#13 /var/www/html/w/includes/skins/SkinTemplate.php(173): MediaWiki\Skin\SkinMustache->generateHTML()
#14 /var/www/html/w/includes/skins/Skin.php(662): MediaWiki\Skin\SkinTemplate->outputPage()
#15 /var/www/html/w/includes/Output/OutputPage.php(3287): MediaWiki\Skin\Skin->outputPageFinal()
#16 /var/www/html/w/includes/actions/ActionEntryPoint.php(160): MediaWiki\Output\OutputPage->output()
#17 /var/www/html/w/includes/MediaWikiEntryPoint.php(184): MediaWiki\Actions\ActionEntryPoint->execute()
#18 /var/www/html/w/index.php(44): MediaWiki\MediaWikiEntryPoint->run()

What should have happened instead?:

This situation could occur if a user is marked with the hidden preference or enables the beta feature, but is not connected to CentralAuth.

If it is easy to connect the account to central auth (and no issues), maybe we could do that? otherwise, log something (warning or info) and not show the bookmark button.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Connecting the account to central auth seems like the solution here.

However, how does this impact our experiment? Can we filter out people not connected to central auth when we deploy? How many people would this impact?

Jdlrobson-WMF set the point value for this task to 1.Oct 15 2025, 5:47 PM

Change #1197668 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Fix error when local user is not connected to CentralAuth

https://gerrit.wikimedia.org/r/1197668

We could add a check to the maintenance script to check if the user is connected to central auth.

In the Wikimedia environment, I think it would be rare that a user account is not connected to CentralAuth but also likely there are at least some edge cases where this occurs. A broken page is a bad experience when the issue occurs.

It is an easy fix for this in the HookHandler class and I have a patch for it in gerrit.

@aude can you provide some replication steps (e.g. a list of steps we can follow to get into the error state?)

SToyofuku-WMF subscribed.

Katie to add replication steps for local repro, then Steph to final review the patch

  1. Enable ReadingLists (via BetaFeatures) for a user on your local wiki.
  1. Install the CentralAuth and AntiSpoof extensions

https://www.mediawiki.org/wiki/Extension:CentralAuth

Create the database tables, which can be in the same database. as your local wiki or you can create a new 'centralauth' database for these:

https://www.mediawiki.org/wiki/Extension:CentralAuth#Run_maintenance_scripts

  1. Login to your local wiki as the user (with reading lists enabled) and pages like the Main_Page should not render due to this bug.
aude removed aude as the assignee of this task.Oct 28 2025, 6:35 PM

Confirmed this works locally! Moving to QA (sorry Edward)

Change #1197668 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Fix error when local user is not connected to CentralAuth

https://gerrit.wikimedia.org/r/1197668

@SToyofuku-WMF This seems like it's not something that would be testable in beta or eventually prod, but specific to dev environments. If that's the case then it can skip QA (by me) since you already verified it.

Katie to confirm when she has time, but I think this is not testable easily, correct

Confirmed can't be QAed - to be signed off by someone that isn't Steph!

Jdrewniak claimed this task.
Jdrewniak subscribed.

This has been verified locally, looks good to resolve!