Page MenuHomePhabricator

UnresolvedRedirectException "Unresolved redirect to Q…" from WikiPageEntityRevisionLookup.php
Closed, ResolvedPublic5 Estimated Story PointsPRODUCTION ERROR

Description

error
PHP Warning: Encountered a UnresolvedRedirectException when trying to load Q60778842 [Called from Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntity in /srv/mediawiki/php-1.33.0-wmf.16/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php at line 153]

Reproduction path: call get entity data lua function on ID of an Item which is a redirect to an Item which is also a redirect (i.e. two redirects).

Impact

This is causing a fatal error during the rendering of pages, which can abort edits from being saved, and existing pages from being rendered.

Analysis

So this is an issue with double redirects.
The behaviour that is done in Mediawiki for wikitext pages is demonstrated at https://test.wikidata.org/wiki/Wikidata:RedirectInclusion

== Redirect 1 ==

{{Wikidata:Redirect1}}

== Redirect 2 ==

{{Wikidata:Redirect2}}

== Target ==

{{Wikidata:RedirectTarget}}

image.png (292×438 px, 15 KB)

Here we see a fallback to something dumb in the double redirect case
Right now in wikidata for LUA inclusion this results in errors.

We could:

  • Provide blank data in cases like this (it would come back when the double redirect is fixed)
  • Follow 1 more layer of redirects (would move the issue to if there triple redirects instead then, less common)
  • Stop wikibase from ever allowing double redirects in any situation?

Product decision:

Let's go for the blank data option.

Acceptance Criteria
  • Double redirects no longer cause fatal errors when accessing data through them in LUA
  • When this sort of data access happens, no data is returned by Wikibase
  • When this sort of data access happens no log messages are created (as this is expected behaviour)

Notes on expected state:
As well as the ACs listed above bots and users would continue to operate on wikidata and affected wikibases to remove these double redirects.
This ticket is only about stopping the logs and exceptions in this situation.

Details

Stack Trace
Wikibase\Lib\Store\UnresolvedRedirectException from line 87 of /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php: Unresolved redirect to Q12773225
#0 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/CachingEntityRevisionLookup.php(152): Wikibase\Lib\Store\WikiPageEntityRevisionLookup->getEntityRevision()
#1 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/CachingEntityRevisionLookup.php(132): Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision()
#2 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/CachingEntityRevisionLookup.php(152): Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision()
#3 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/CachingEntityRevisionLookup.php(132): Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision()
#4 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/RevisionBasedEntityLookup.php(41): Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision()
#5 (): Wikibase\Lib\Store\RevisionBasedEntityLookup->getEntity()
#6 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/EntityRedirectResolvingDecorator.php(79): call_user_func_array()
#7 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/RedirectResolvingEntityLookup.php(50): Wikibase\Lib\Store\EntityRedirectResolvingDecorator->__call()
#8 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php(165): Wikibase\Lib\Store\RedirectResolvingEntityLookup->getEntity()
#9 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php(273): Wikibase\Client\Scribunto\WikibaseLuaBindings->getSiteLinkPageName()
#10 /srv/mediawiki/php-1.25wmf21/extensions/Scribunto/engines/LuaSandbox/Engine.php(384): Scribunto_LuaWikibaseLibrary->getSiteLinkPageName()
#11 (): Scribunto_LuaSandboxCallback->__call()
#12 /srv/mediawiki/php-1.25wmf21/extensions/Scribunto/engines/LuaSandbox/Engine.php(297): LuaSandboxFunction->call()
#13 /srv/mediawiki/php-1.25wmf21/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(257): Scribunto_LuaSandboxInterpreter->callFunction()
#14 /srv/mediawiki/php-1.25wmf21/extensions/Scribunto/engines/LuaCommon/LuaCommon.php(873): Scribunto_LuaEngine->executeFunctionChunk()
#15 /srv/mediawiki/php-1.25wmf21/extensions/Scribunto/common/Hooks.php(113): Scribunto_LuaModule->invoke()
#16 /srv/mediawiki/php-1.25wmf21/includes/parser/Parser.php(3768): ScribuntoHooks::invokeHook()
#17 /srv/mediawiki/php-1.25wmf21/includes/parser/Parser.php(3502): Parser->callParserFunction()
#18 /srv/mediawiki/php-1.25wmf21/includes/parser/Preprocessor_Hash.php(1094): Parser->braceSubstitution()
#19 /srv/mediawiki/php-1.25wmf21/includes/parser/Parser.php(3644): PPFrame_Hash->expand()
#20 /srv/mediawiki/php-1.25wmf21/includes/parser/Preprocessor_Hash.php(1094): Parser->braceSubstitution()

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

we get these on the repo also:

Wikibase\Lib\Store\UnresolvedRedirectException from line 87 of /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php: Unresolved redirect to Q744286
#0 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(276): Wikibase\Lib\Store\WikiPageEntityRevisionLookup->getEntityRevision()
#1 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(703): Wikibase\EditEntity->getLatestRevision()
#2 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ApiWikibase.php(427): Wikibase\EditEntity->attemptSave()
#3 /srv/mediawiki/php-1.25wmf21/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ModifyEntity.php(374): Wikibase\Api\ApiWikibase->attemptSaveEntity()
#4 /srv/mediawiki/php-1.25wmf21/includes/api/ApiMain.php(1037): Wikibase\Api\ModifyEntity->execute()
#5 /srv/mediawiki/php-1.25wmf21/includes/api/ApiMain.php(394): ApiMain->executeAction()
#6 /srv/mediawiki/php-1.25wmf21/includes/api/ApiMain.php(367): ApiMain->executeActionWithErrorHandling()
#7 /srv/mediawiki/php-1.25wmf21/api.php(84): ApiMain->execute()

and still happens.... :(

/w/api.php Wikibase\Lib\Store\UnresolvedRedirectException from line 88 of /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php: Unresolved redirect to Q9220132
#0 /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(264): Wikibase\Lib\Store\WikiPageEntityRevisionLookup->getEntityRevision()
#1 /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(612): Wikibase\EditEntity->getLatestRevision()
#2 /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ApiWikibase.php(435): Wikibase\EditEntity->attemptSave()
#3 /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ModifyClaim.php(68): Wikibase\Api\ApiWikibase->attemptSaveEntity()
#4 /srv/mediawiki/php-1.26wmf9/extensions/Wikidata/extensions/Wikibase/repo/includes/api/SetClaim.php(88): Wikibase\Api\ModifyClaim->saveChanges()
#5 /srv/mediawiki/php-1.26wmf9/includes/api/ApiMain.php(1130): Wikibase\Api\SetClaim->execute()
#6 /srv/mediawiki/php-1.26wmf9/includes/api/ApiMain.php(469): ApiMain->executeAction()
#7 /srv/mediawiki/php-1.26wmf9/includes/api/ApiMain.php(442): ApiMain->executeActionWithErrorHandling()
#8 /srv/mediawiki/php-1.26wmf9/api.php(88): ApiMain->execute()

aude renamed this task from UnresolvedRedirectException from line 87 of WikiPageEntityRevisionLookup.php to [Bug] UnresolvedRedirectException from line 87 of WikiPageEntityRevisionLookup.php.Aug 14 2015, 9:00 AM
aude set Security to None.

still happens....

/w/api.php Wikibase\Lib\Store\UnresolvedRedirectException from line 87 of /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php: Unresolved redirect to Q607715 {"exception":"[Exception Wikibase\\Lib\\Store\\UnresolvedRedirectException] (/srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/lib/includes/store/sql/WikiPageEntityRevisionLookup.php:87) Unresolved redirect to Q607715\n[stacktrace]\n#0 /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(264): Wikibase\\Lib\\Store\\WikiPageEntityRevisionLookup->getEntityRevision(Wikibase\\DataModel\\Entity\\ItemId, string)\n#1 /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/repo/includes/EditEntity.php(612): Wikibase\\EditEntity->getLatestRevision()\n#2 /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/repo/includes/api/EntitySavingHelper.php(111): Wikibase\\EditEntity->attemptSave(string, integer, string)\n#3 /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ModifyEntity.php(165): Wikibase\\Repo\\Api\\EntitySavingHelper->attemptSaveEntity(Wikibase\\DataModel\\Entity\\Item, string, integer)\n#4 /srv/mediawiki/php-1.26wmf17/extensions/Wikidata/extensions/Wikibase/repo/includes/api/ModifyEntity.php(455): Wikibase\\Repo\\Api\\ModifyEntity->attemptSaveEntity(Wikibase\\DataModel\\Entity\\Item, Wikibase\\Summary, integer)\n#5 /srv/mediawiki/php-1.26wmf17/includes/api/ApiMain.php(1126): Wikibase\\Repo\\Api\\ModifyEntity->execute()\n#6 /srv/mediawiki/php-1.26wmf17/includes/api/ApiMain.php(465): ApiMain->executeAction()\n#7 /srv/mediawiki/php-1.26wmf17/includes/api/ApiMain.php(438): ApiMain->executeActionWithErrorHandling()\n#8 /srv/mediawiki/php-1.26wmf17/api.php(88): ApiMain->execute()\n#9 /srv/mediawiki/w/api.php(3): include(string)\n#10 {main}\n"}

still happens, though in a different place...

Warning: Encountered a UnresolvedRedirectException when trying to load Q19856755 [Called from Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntity in /srv/mediawiki/php-1.28.0-wmf.13/extensions/Wikidata/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php at line 139] in /srv/mediawiki/php-1.28.0-wmf.13/includes/debug/MWDebug.php on line 309

code says "We probably hit a double redirect" and it's just a warning

Krinkle moved this task from Untriaged to Older on the Wikimedia-production-error board.
Krinkle added subscribers: mmodell, Krinkle, PokestarFan.

Still seen on 1.32.0-wmf.23, e.g..

[W6u7jwrAEG8AAJ9ZM1cAAABO] /w/api.php Wikibase\Lib\Store\RevisionedUnresolvedRedirectException from line 127 of /srv/mediawiki/php-1.32.0-wmf.23/extensions/Wikibase/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php: Unresolved redirect to Q17532667

Change 471194 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/WikibaseQualityConstraints@master] ValueTypeChecker: Handle unresolved redirects

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

Change 471202 had a related patch set uploaded (by Hoo man; owner: Hoo man):
[mediawiki/extensions/Wikibase@master] EditEntity::attemptSave: Fail (don't throw) on redirect

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

Change 471194 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] ValueTypeChecker: Handle unresolved redirects

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

Change 473719 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseQualityConstraints@master] Add ExceptionIgnoringEntityLookup

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

Change 471202 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] EditEntity::attemptSave: Fail (don't throw) on redirect

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

Change 473719 merged by jenkins-bot:
[mediawiki/extensions/WikibaseQualityConstraints@master] Add ExceptionIgnoringEntityLookup

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

This now affects Wikimedia Commons as well, and seemingly more frequent there than on Wikidata.org.

Recent sample:

PHP Warning: Encountered a UnresolvedRedirectException when trying to load Q60778842 [Called from Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntity in /srv/mediawiki/php-1.33.0-wmf.16/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php at line 153]
#3 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php(153): wfLogWarning(string)
#4 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Wikibase/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php(393): Wikibase\Client\DataAccess\Scribunto\EntityAccessor->getEntity(string)
#5 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Scribunto/includes/engines/LuaSandbox/Engine.php(393): Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->getEntity(string)
#6 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#7 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Scribunto/includes/engines/LuaSandbox/Engine.php(316): LuaSandboxFunction->call(LuaSandboxFunction)
#8 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Scribunto/includes/engines/LuaCommon/LuaCommon.php(296): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#9 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Scribunto/includes/engines/LuaCommon/LuaCommon.php(982): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#10 /srv/mediawiki/php-1.33.0-wmf.16/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#11 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(3515): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#12 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(3222): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#13 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Preprocessor_Hash.php(1114): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#14 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(3396): PPFrame_Hash->expand(PPNode_Hash_Tree)
#15 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Preprocessor_Hash.php(1114): Parser->braceSubstitution(array, PPFrame_Hash)
#16 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(3036): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#17 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(1354): Parser->replaceVariables(string)
#18 /srv/mediawiki/php-1.33.0-wmf.16/includes/parser/Parser.php(482): Parser->internalParse(string)
#19 /srv/mediawiki/php-1.33.0-wmf.16/includes/content/WikitextContent.php(369): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#20 /srv/mediawiki/php-1.33.0-wmf.16/includes/content/AbstractContent.php(555): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#21 /srv/mediawiki/php-1.33.0-wmf.16/includes/Revision/RenderedRevision.php(266): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#22 /srv/mediawiki/php-1.33.0-wmf.16/includes/Revision/RenderedRevision.php(234): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#23 /srv/mediawiki/php-1.33.0-wmf.16/includes/Revision/RevisionRenderer.php(193): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string)
#24 /srv/mediawiki/php-1.33.0-wmf.16/includes/Revision/RevisionRenderer.php(142): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#25 [internal function]: Closure$MediaWiki\Revision\RevisionRenderer::getRenderedRevision#2(MediaWiki\Revision\RenderedRevision, array)
#26 /srv/mediawiki/php-1.33.0-wmf.16/includes/Revision/RenderedRevision.php(197): call_user_func(Closure$MediaWiki\Revision\RevisionRenderer::getRenderedRevision#2;982, MediaWiki\Revision\RenderedRevision, array)
#27 /srv/mediawiki/php-1.33.0-wmf.16/includes/poolcounter/PoolWorkArticleView.php(194): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#28 /srv/mediawiki/php-1.33.0-wmf.16/includes/poolcounter/PoolCounterWork.php(123): PoolWorkArticleView->doWork()
#29 /srv/mediawiki/php-1.33.0-wmf.16/includes/page/Article.php(774): PoolCounterWork->execute()
#30 /srv/mediawiki/php-1.33.0-wmf.16/includes/page/ImagePage.php(148): Article->view()
#31 /srv/mediawiki/php-1.33.0-wmf.16/includes/actions/ViewAction.php(68): ImagePage->view()
#32 /srv/mediawiki/php-1.33.0-wmf.16/includes/MediaWiki.php(501): ViewAction->show()
#33 /srv/mediawiki/php-1.33.0-wmf.16/includes/MediaWiki.php(294): MediaWiki->performAction(ImagePage, Title)
#34 /srv/mediawiki/php-1.33.0-wmf.16/includes/MediaWiki.php(862): MediaWiki->performRequest()
#35 /srv/mediawiki/php-1.33.0-wmf.16/includes/MediaWiki.php(517): MediaWiki->main()
#36 /srv/mediawiki/php-1.33.0-wmf.16/index.php(42): MediaWiki->run()
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:12 PM
Krinkle renamed this task from [Bug] UnresolvedRedirectException from line 87 of WikiPageEntityRevisionLookup.php to UnresolvedRedirectException "Unresolved redirect to Q…" from WikiPageEntityRevisionLookup.php.Oct 12 2019, 10:35 PM
Krinkle updated the task description. (Show Details)
Krinkle edited Stack Trace. (Show Details)
Krinkle added a project: Wikidata-Campsite.

Still occuring today, but at quite a low frequency

PHP Warning: Encountered a UnresolvedRedirectException when trying to load Q89581830 [Called from Wikibase\Client\DataAccess\Scribunto\EntityAccessor::getEntityStatements in /srv/mediawiki/php-1.35.0-wmf.28/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php at line 220]
t exception.trace	   	#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.28/includes/debug/MWDebug.php(333): trigger_error(string, integer)
#2 /srv/mediawiki/php-1.35.0-wmf.28/includes/debug/MWDebug.php(188): MWDebug::sendMessage(string, array, string, integer)
#3 /srv/mediawiki/php-1.35.0-wmf.28/includes/GlobalFunctions.php(1066): MWDebug::warning(string, integer, integer, string)
#4 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Wikibase/client/includes/DataAccess/Scribunto/EntityAccessor.php(220): wfLogWarning(string)
#5 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Wikibase/client/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseLibrary.php(521): Wikibase\Client\DataAccess\Scribunto\EntityAccessor->getEntityStatements(string, string, string)
#6 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->getEntityStatements(string, string, string)
#7 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#8 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(113): LuaSandboxFunction->call(LuaSandboxFunction)
#9 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(291): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#10 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(69): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#11 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#12 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3613): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#13 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3317): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#14 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#15 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPTemplateFrame_Hash.php(169): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#16 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPTemplateFrame_Hash.php(181): PPTemplateFrame_Hash->getNamedArgument(string)
#17 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(674): PPTemplateFrame_Hash->getArgument(string)
#18 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxCallback.php(26): Scribunto_LuaEngine->getExpandedArgument(string, string)
#19 [internal function]: Scribunto_LuaSandboxCallback->__call(string, array)
#20 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(113): LuaSandboxFunction->call(LuaSandboxFunction)
#21 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(291): Scribunto_LuaSandboxInterpreter->callFunction(LuaSandboxFunction, LuaSandboxFunction)
#22 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(69): Scribunto_LuaEngine->executeFunctionChunk(LuaSandboxFunction, PPTemplateFrame_Hash)
#23 /srv/mediawiki/php-1.35.0-wmf.28/extensions/Scribunto/includes/common/Hooks.php(128): Scribunto_LuaModule->invoke(string, PPTemplateFrame_Hash)
#24 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3613): ScribuntoHooks::invokeHook(Parser, PPTemplateFrame_Hash, array)
#25 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3317): Parser->callParserFunction(PPTemplateFrame_Hash, string, array)
#26 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#27 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3495): PPFrame_Hash->expand(PPNode_Hash_Tree)
#28 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution(array, PPTemplateFrame_Hash)
#29 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPTemplateFrame_Hash.php(89): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#30 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3492): PPTemplateFrame_Hash->cachedExpand(string, PPNode_Hash_Tree)
#31 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/PPFrame_Hash.php(253): Parser->braceSubstitution(array, PPFrame_Hash)
#32 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(3158): PPFrame_Hash->expand(PPNode_Hash_Tree, integer)
#33 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(1504): Parser->replaceVariables(string)
#34 /srv/mediawiki/php-1.35.0-wmf.28/includes/parser/Parser.php(618): Parser->internalParse(string)
#35 /srv/mediawiki/php-1.35.0-wmf.28/includes/content/WikitextContent.php(368): Parser->parse(string, Title, ParserOptions, boolean, boolean, integer)
#36 /srv/mediawiki/php-1.35.0-wmf.28/includes/content/AbstractContent.php(565): WikitextContent->fillParserOutput(Title, integer, ParserOptions, boolean, ParserOutput)
#37 /srv/mediawiki/php-1.35.0-wmf.28/includes/Revision/RenderedRevision.php(267): AbstractContent->getParserOutput(Title, integer, ParserOptions, boolean)
#38 /srv/mediawiki/php-1.35.0-wmf.28/includes/Revision/RenderedRevision.php(236): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#39 /srv/mediawiki/php-1.35.0-wmf.28/includes/Revision/RevisionRenderer.php(215): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string)
#40 /srv/mediawiki/php-1.35.0-wmf.28/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#41 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#42 /srv/mediawiki/php-1.35.0-wmf.28/includes/Revision/RenderedRevision.php(198): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#43 /srv/mediawiki/php-1.35.0-wmf.28/includes/poolcounter/PoolWorkArticleView.php(196): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#44 /srv/mediawiki/php-1.35.0-wmf.28/includes/poolcounter/PoolCounterWork.php(125): PoolWorkArticleView->doWork()
#45 /srv/mediawiki/php-1.35.0-wmf.28/includes/page/WikiPage.php(1266): PoolCounterWork->execute()
#46 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiParse.php(83): WikiPage->getParserOutput(ParserOptions, integer, boolean)
#47 /srv/mediawiki/php-1.35.0-wmf.28/includes/poolcounter/PoolCounterWorkViaCallback.php(69): ApiParse->{closure}()
#48 /srv/mediawiki/php-1.35.0-wmf.28/includes/poolcounter/PoolCounterWork.php(125): PoolCounterWorkViaCallback->doWork()
#49 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiParse.php(90): PoolCounterWork->execute()
#50 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiParse.php(660): ApiParse->getPageParserOutput(WikiCategoryPage, NULL, ParserOptions, boolean)
#51 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiParse.php(222): ApiParse->getParsedContent(WikiCategoryPage, ParserOptions, boolean, NULL, NULL, boolean)
#52 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiMain.php(1580): ApiParse->execute()
#53 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiMain.php(523): ApiMain->executeAction()
#54 /srv/mediawiki/php-1.35.0-wmf.28/includes/api/ApiMain.php(494): ApiMain->executeActionWithErrorHandling()
#55 /srv/mediawiki/php-1.35.0-wmf.28/api.php(84): ApiMain->execute()
#56 /srv/mediawiki/w/api.php(3): require(string)
#57 {main}

This should be as simple as wrapping the EntityLookup that is used to create the RestrictedEntityLookup for use in LUA to be a RedirectResolvingEntityLookup.
Right now WikibaseRepo::getRestrictedEntityLookup is used by a few different code paths, and we probably only want to add this redirect resolving to where it is needed, right now only being LUA.
Thus a second method would probably be best.

We should also decide if this wraps the RestrictedEntityLookup, or if it wraps the lookup from getEntityLookup() as both will have different affects.
To keep the behaviour / number of lookups that can happen via LUA the same, it might be best to wrap the getEntityLookup() call.

6 occurrences seen in logstash on 2020-07-29, all for ruwiki

So this is an issue with double redirects.
The behaviour that is done in Mediawiki for wikitext pages is demonstrated at https://test.wikidata.org/wiki/Wikidata:RedirectInclusion

== Redirect 1 ==

{{Wikidata:Redirect1}}

== Redirect 2 ==

{{Wikidata:Redirect2}}

== Target ==

{{Wikidata:RedirectTarget}}

image.png (292×438 px, 15 KB)

Here we see a fallback to something dumb in the double redirect case
Right now in wikidata for LUA inclusion this results in errors.

We could:

  • Provide blank data in cases like this (it would come back when the double redirect is fixed)
  • Follow 1 more layer of redirects (would move the issue to if there triple redirects instead then, less common)
  • Stop wikibase from ever allowing double redirects in any situation?

Task inspection notes:

  • The “no longer cause fatal errors” and “no data is returned” ACs are already fulfilled since 2015, thanks to T108252 (created and resolved only a few months after this task was created).
  • We interpret “no data is returned” / “blank data” to mean that returning nil to Lua is acceptable, and we don’t need to synthesize a blank item like {"type": "item", "labels": {}}.
  • So the only think left to do is to remove the logging (or possibly lower its level to notice/info; in this case, we can also inject a logger instead of using the global wfLogWarning() function).

Change 635831 had a related patch set uploaded (by Tobias Andersson; owner: Tobias Andersson):
[mediawiki/extensions/Wikibase@master] add logger to EntityAccessor

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

Change 635831 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] add logger to EntityAccessor

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

No errors since a week. I haven't seen INFOs "Unresolved redirect encountered..." logged yet. This is probably awaiting the deployment of the new code to Wikipedias/Commons. Will wait a few more days before calling it done

I gather this is in stalled/waiting to be verified?
I'd be pro leaving it in verified if that is the case so it is not forgotten about (it's not actively blocked on something).
Or is this in stalled waiting as it isn't deployed?

Might be worth codifying what we do with tasks in those situations, historically I remember things being left in test/verification while awaiting deployment.

This was tagged at wmf.16 which is now deployed so going to move it back to the verification column (as the above doesn't have an answer)

I looked through Logstash mediawiki-errors; the old error message (UnresolvedRedirectException) hasn’t been seen since November 1st, and the new log message (“Unresolved redirect encountered”) isn’t in mediawiki-errors at all because it’s an info-level message. I think we’re done here.