Page MenuHomePhabricator

TypeError on a diff of Wikidata talk page
Closed, ResolvedPublic5 Estimated Story PointsPRODUCTION ERROR

Description

Error message
[X-2tLApAMNQAAaogpxYAAAAT] 2021-01-12 14:07:41: Fatal exception of type "TypeError"
Stack Trace
 Argument 1 passed to Wikibase\Lib\Store\EntityLinkTargetEntityIdLookup::parseEntityId() must be of the type string, null given, called in /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/lib/includes/Store/EntityLinkTargetEntityIdLookup.php on line 64
#0 /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/lib/includes/Store/EntityLinkTargetEntityIdLookup.php(64): Wikibase\Lib\Store\EntityLinkTargetEntityIdLookup->parseEntityId(NULL)
#1 /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/lib/includes/Store/EntityLinkTargetEntityIdLookup.php(54): Wikibase\Lib\Store\EntityLinkTargetEntityIdLookup->getEntityIdFromExternalLink(Title)
#2 /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php(315): Wikibase\Lib\Store\EntityLinkTargetEntityIdLookup->getEntityId(Title)
#3 /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php(248): Wikibase\Repo\Hooks\HtmlPageLinkRendererEndHookHandler->internalDoHtmlPageLinkRendererEnd(MediaWiki\Linker\LinkRenderer, Title, HtmlArmor, array, RequestContext, Wikibase\Repo\Hooks\Formatters\EntityLinkFormatterFactory, NULL)
#4 /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php(175): Wikibase\Repo\Hooks\HtmlPageLinkRendererEndHookHandler->doHtmlPageLinkRendererEnd(MediaWiki\Linker\LinkRenderer, Title, HtmlArmor, array, RequestContext, NULL)
#5 /srv/mediawiki/php-1.36.0-wmf.25/includes/HookContainer/HookContainer.php(163): Wikibase\Repo\Hooks\HtmlPageLinkRendererEndHookHandler->onHtmlPageLinkRendererEnd(MediaWiki\Linker\LinkRenderer, Title, boolean, HtmlArmor, array, NULL)
#6 /srv/mediawiki/php-1.36.0-wmf.25/includes/HookContainer/HookRunner.php(2079): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /srv/mediawiki/php-1.36.0-wmf.25/includes/linker/LinkRenderer.php(308): MediaWiki\HookContainer\HookRunner->onHtmlPageLinkRendererEnd(MediaWiki\Linker\LinkRenderer, Title, boolean, HtmlArmor, array, NULL)
#8 /srv/mediawiki/php-1.36.0-wmf.25/includes/linker/LinkRenderer.php(215): MediaWiki\Linker\LinkRenderer->buildAElement(Title, HtmlArmor, array, boolean)
#9 /srv/mediawiki/php-1.36.0-wmf.25/includes/linker/LinkRenderer.php(242): MediaWiki\Linker\LinkRenderer->makePreloadedLink(Title, HtmlArmor, string, array, array)
#10 /srv/mediawiki/php-1.36.0-wmf.25/includes/linker/LinkRenderer.php(165): MediaWiki\Linker\LinkRenderer->makeKnownLink(Title, HtmlArmor, array, array)
#11 /srv/mediawiki/php-1.36.0-wmf.25/includes/parser/LinkHolderArray.php(329): MediaWiki\Linker\LinkRenderer->makeLink(Title, HtmlArmor)
#12 /srv/mediawiki/php-1.36.0-wmf.25/includes/parser/LinkHolderArray.php(168): LinkHolderArray->replaceInterwiki(string)
#13 /srv/mediawiki/php-1.36.0-wmf.25/includes/parser/Parser.php(4928): LinkHolderArray->replace(string)
#14 /srv/mediawiki/php-1.36.0-wmf.25/includes/parser/Parser.php(1647): Parser->replaceLinkHoldersPrivate(string)
#15 /srv/mediawiki/php-1.36.0-wmf.25/includes/parser/Parser.php(649): Parser->internalParseHalfParsed(string, boolean, boolean)
#16 /srv/mediawiki/php-1.36.0-wmf.25/includes/content/WikitextContent.php(375): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#17 /srv/mediawiki/php-1.36.0-wmf.25/includes/content/AbstractContent.php(591): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#18 /srv/mediawiki/php-1.36.0-wmf.25/includes/Revision/RenderedRevision.php(266): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#19 /srv/mediawiki/php-1.36.0-wmf.25/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#20 /srv/mediawiki/php-1.36.0-wmf.25/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#21 /srv/mediawiki/php-1.36.0-wmf.25/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#22 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#23 /srv/mediawiki/php-1.36.0-wmf.25/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#24 /srv/mediawiki/php-1.36.0-wmf.25/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#25 /srv/mediawiki/php-1.36.0-wmf.25/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#26 /srv/mediawiki/php-1.36.0-wmf.25/includes/page/ParserOutputAccess.php(260): PoolCounterWork->execute()
#27 /srv/mediawiki/php-1.36.0-wmf.25/includes/page/WikiPage.php(1212): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiPage, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer)
#28 /srv/mediawiki/php-1.36.0-wmf.25/includes/diff/DifferenceEngine.php(1111): WikiPage->getParserOutput(ParserOptions, integer)
#29 /srv/mediawiki/php-1.36.0-wmf.25/includes/diff/DifferenceEngine.php(1068): DifferenceEngine->getParserOutput(WikiPage, MediaWiki\Revision\RevisionStoreRecord)
#30 /srv/mediawiki/php-1.36.0-wmf.25/includes/diff/DifferenceEngine.php(896): DifferenceEngine->renderNewRevision()
#31 /srv/mediawiki/php-1.36.0-wmf.25/includes/page/Article.php(942): DifferenceEngine->showDiffPage(boolean)
#32 /srv/mediawiki/php-1.36.0-wmf.25/includes/page/Article.php(527): Article->showDiffPage()
#33 /srv/mediawiki/php-1.36.0-wmf.25/includes/actions/ViewAction.php(74): Article->view()
#34 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(532): ViewAction->show()
#35 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(316): MediaWiki->performAction(Article, Title)
#36 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(945): MediaWiki->performRequest()
#37 /srv/mediawiki/php-1.36.0-wmf.25/includes/MediaWiki.php(548): MediaWiki->main()
#38 /srv/mediawiki/php-1.36.0-wmf.25/index.php(53): MediaWiki->run()
#39 /srv/mediawiki/php-1.36.0-wmf.25/index.php(46): wfIndexMain()
#40 /srv/mediawiki/w/index.php(3): require(string)
#41 {main}

More specific error message:

Argument 1 passed to Wikibase\Lib\Store\EntityLinkTargetEntityIdLookup::parseEntityId() must be of the type string, null given, called in /srv/mediawiki/php-1.36.0-wmf.25/extensions/Wikibase/lib/includes/Store/EntityLinkTargetEntityIdLookup.php on line 64
Impact

Cannot view one particular diff. No idea if there are other occurrences.

  1. Notes

Details

Request ID
X-2tLApAMNQAAaogpxYAAAAT
Request URL
https://www.wikidata.org/w/index.php?title=Module_talk:Wikidata_label&diff=1212236616&oldid=1187684010

Event Timeline

Lydia_Pintscher subscribed.

Looking at https://www.wikidata.org/w/index.php?title=Module_talk:Wikidata_label&action=history and the individual diffs there:
https://www.wikidata.org/w/index.php?title=Module_talk:Wikidata_label&diff=1212236616&oldid=1187684010 from June 20th 2020 seems to be the first edit that throws an error. All the ones after that do as well for me.

Setting this to high because inaccessible diffs are bad!

WMDE-leszek added subscribers: noarave, WMDE-leszek.

Suspected it might be related to some recent change. @noarave to provide details on this lead.

Lucas_Werkmeister_WMDE changed Request URL from https://www.wikidata.org/w/index.php?title=Module_talk:Wikidata_label&type=revision&diff=1336359134&oldid=1304092360&uselang=en to https://www.wikidata.org/w/index.php?title=Module_talk:Wikidata_label&diff=1212236616&oldid=1187684010.EditedJan 12 2021, 2:11 PM
Lucas_Werkmeister_WMDE changed Request ID from X-bb3gpAMNYAARQCiYsAAABH to X-2tLApAMNQAAaogpxYAAAAT.
Lucas_Werkmeister_WMDE updated the task description. (Show Details)

(I edited the request URL and request ID because the old request URL no longer produced an error, for some reason.)

WMDE-leszek set the point value for this task to 5.Jan 12 2021, 2:12 PM
brennen subscribed.

Noticed a further 11 of these this morning in 1.36.0-wmf.27.

This can be reproduced locally by making the main namespace an entity namespace (which is the case on Wikidata, but typically not on local test wikis, which have a separate Item: namespace):

LocalSettings.php
$wgWBRepoSettings['entityNamespaces']['item'] = NS_MAIN; // testing T271402

Then put the wikitext [[d:Special:EntityPage]] on a page and look at a diff where that wikitext is in the rendered page content.

  • HtmlPageLinkRendererEndHookHandler::doHtmlPageLinkRendererEnd() runs, to potentially add a label to links (meant to be only links in edit summaries)
  • the link has no custom text, and the request is one where labels should be added to links in edit summaries (a diff request and not an API request), so doHtmlPageLinkRendererEnd() calls internalDoHtmlPageLinkRendererEnd()
  • internalDoHtmlPageLinkRendererEnd() tries to parse the link as a foreign entity ID (which fails), and returns if that fails and if the target namespace is not an entity namespace
    • because the link is an interwiki link, it is parsed as a link to the “d:” wiki (Wikidata), with namespace 0 (main namespace) and text “Special:EntityPage”; namespace 0 is an entity namespace
    • therefore internalDoHtmlPageLinkRendererEnd() does not return, but continues
  • internalDoHtmlPageLinkRendererEnd() asks its linkTargetEntityIdLookup to get the entity ID
  • EntityLinkTargetEntityIdLookup::getEntityId() determines the link is external and delegates to getEntityIdFromExternalLink()
  • getEntityIdFromExternalLink() splits the link text (expected to be something like “Special:EntityPage/Q123”, actually “Special:EntityPage”) on / into two parts and passes the second part (expected to be something like “Q123”, actually the second element of a one-element array, i.e. null with a PHP notice “undefined offset”) into parseEntityId()
  • parseEntityId() (rightly) complains that it was passed null when it expects a string

Change 657823 had a related patch set uploaded (by Rosalie Perside (WMDE); owner: Rosalie Perside (WMDE)):
[mediawiki/extensions/Wikibase@master] TypeError on Wikidata talk page diff

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

Change 657823 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] TypeError on Wikidata talk page diff

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

Will be deployed this week and can then be verified

This will now be deployed this week (It's in .28), .27 is still currently deployed and .29 is going out this week.