Page MenuHomePhabricator

LogicException: This ParserOutput contains no text!
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   LogicException: This ParserOutput contains no text!
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.12/includes/parser/ParserOutput.php(363)
#0 /srv/mediawiki/php-1.39.0-wmf.12/includes/parser/ParserOutput.php(412): ParserOutput->getRawText()
#1 /srv/mediawiki/php-1.39.0-wmf.12/extensions/CommonsMetadata/src/DataCollector.php(120): ParserOutput->getText()
#2 /srv/mediawiki/php-1.39.0-wmf.12/extensions/CommonsMetadata/src/HookHandler.php(152): CommonsMetadata\DataCollector->verifyAttributionMetadata(ParserOutput, LocalFile)
#3 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookContainer.php(338): CommonsMetadata\HookHandler::onContentAlterParserOutput(WikitextContent, Title, ParserOutput)
#4 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#5 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookRunner.php(1199): MediaWiki\HookContainer\HookContainer->run(string, array)
#6 /srv/mediawiki/php-1.39.0-wmf.12/includes/content/ContentHandler.php(1729): MediaWiki\HookContainer\HookRunner->onContentAlterParserOutput(WikitextContent, Title, ParserOutput)
#7 /srv/mediawiki/php-1.39.0-wmf.12/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput(WikitextContent, MediaWiki\Content\Renderer\ContentParseParams)
#8 /srv/mediawiki/php-1.39.0-wmf.12/includes/Revision/RenderedRevision.php(270): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput(WikitextContent, Title, NULL, ParserOptions, boolean)
#9 /srv/mediawiki/php-1.39.0-wmf.12/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(WikitextContent, boolean)
#10 /srv/mediawiki/php-1.39.0-wmf.12/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#11 /srv/mediawiki/php-1.39.0-wmf.12/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#12 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#13 /srv/mediawiki/php-1.39.0-wmf.12/includes/Revision/RenderedRevision.php(199): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#14 /srv/mediawiki/php-1.39.0-wmf.12/extensions/TemplateData/includes/Hooks.php(100): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput(array)
#15 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookContainer.php(338): MediaWiki\Extension\TemplateData\Hooks::onMultiContentSave(MediaWiki\Revision\RenderedRevision, User, CommentStoreComment, integer, Status)
#16 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#17 /srv/mediawiki/php-1.39.0-wmf.12/includes/HookContainer/HookRunner.php(2590): MediaWiki\HookContainer\HookContainer->run(string, array)
#18 /srv/mediawiki/php-1.39.0-wmf.12/includes/Storage/PageUpdater.php(894): MediaWiki\HookContainer\HookRunner->onMultiContentSave(MediaWiki\Revision\RenderedRevision, User, CommentStoreComment, integer, Status)
#19 /srv/mediawiki/php-1.39.0-wmf.12/includes/MovePage.php(997): MediaWiki\Storage\PageUpdater->saveRevision(CommentStoreComment)
#20 /srv/mediawiki/php-1.39.0-wmf.12/includes/MovePage.php(674): MovePage->moveToInternal(User, Title, string, boolean, array)
#21 /srv/mediawiki/php-1.39.0-wmf.12/includes/MovePage.php(520): MovePage->moveUnsafe(User, string, boolean, array)
#22 /srv/mediawiki/php-1.39.0-wmf.12/includes/api/ApiMove.php(120): MovePage->moveIfAllowed(User, string, boolean, array)
#23 /srv/mediawiki/php-1.39.0-wmf.12/includes/api/ApiMain.php(1902): ApiMove->execute()
#24 /srv/mediawiki/php-1.39.0-wmf.12/includes/api/ApiMain.php(874): ApiMain->executeAction()
#25 /srv/mediawiki/php-1.39.0-wmf.12/includes/api/ApiMain.php(845): ApiMain->executeActionWithErrorHandling()
#26 /srv/mediawiki/php-1.39.0-wmf.12/api.php(90): ApiMain->execute()
#27 /srv/mediawiki/php-1.39.0-wmf.12/api.php(45): wfApiMain()
#28 /srv/mediawiki/w/api.php(3): require(string)
#29 {main}
Notes

Details

Event Timeline

TheresNoTime set Release Version to 1.39.0-wmf.12.
jnuche triaged this task as Unbreak Now! priority.May 18 2022, 1:47 PM

Escalating since it's a user-facing problem affecting basic functionality.

Replicated on the beta cluster:

  1. Visit https://commons.wikimedia.beta.wmflabs.org/wiki/File:PicKt2.jpg
  2. Attempt to move the file leaving behind a redirect (if the redirection is suppressed, it works)

YoT57cF3qLsEu6N-L3g6LQAAAMI on beta-logs.wmcloud

Ladsgroup subscribed.

This seems like an issue for the platform team.

Agreed. CommonsMetadata\HookHandler::onContentAlterParserOutput() should probably add $parserOutput->hasText() to its early return condition. (Although I'm not sure when would a wikitext content object not have text.)

Change 793073 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/extensions/CommonsMetadata@master] Return early if the ParserOutput doesn't have any text

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

Change 793073 merged by jenkins-bot:

[mediawiki/extensions/CommonsMetadata@master] Return early if the ParserOutput doesn't have any text

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

Change 792659 had a related patch set uploaded (by Jforrester; author: Amir Sarabadani):

[mediawiki/extensions/CommonsMetadata@wmf/1.39.0-wmf.12] Return early if the ParserOutput doesn't have any text

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

Change 792659 merged by jenkins-bot:

[mediawiki/extensions/CommonsMetadata@wmf/1.39.0-wmf.12] Return early if the ParserOutput doesn't have any text

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

Mentioned in SAL (#wikimedia-operations) [2022-05-18T15:32:03Z] <ladsgroup@deploy1002> Synchronized php-1.39.0-wmf.12/extensions/CommonsMetadata/src: Backport: [[gerrit:792659|Return early if the ParserOutput doesn't have any text (T308663)]] (duration: 00m 52s)

Ladsgroup claimed this task.

Testing it in test commons it seems it's fixed now: https://test-commons.wikimedia.org/w/index.php?title=File:Watch-foop.svg&oldid=4408

Reopen if it's not fixed.

Did we identify the root cause? (ie, what was the change being deployed that caused this to trigger?)

Did we identify the root cause? (ie, what was the change being deployed that caused this to trigger?)

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/785247 was the cause.

Did we identify the root cause? (ie, what was the change being deployed that caused this to trigger?)

ParserOutput has always been documented to represent "no HTML output" with null and throw on getText() in that case, but that was mostly broken (it actually just returned an empty string). rMWbec8dada48e5: Clarify generate-html and make ParserOutput behave as expected fixed that. Redirect pages do not generate HTML output (apparently) so that fix causes error in code which is called for redirect content, and does not check hasText().
(Here is an approximate search; "getText" is a bit too generic to be easily searchable.)

Maybe we should temporarily replace the exception with logging and return an empty string?

Redirect pages do not generate HTML output (apparently)

That seems odd. All pages should generate HTML output, unless explicitly told that it can be omitted in a given context.

hashar subscribed.

There are still some LogicException: This ParserOutput contains no text! messages which most probably have a different cause than redirect articles generating empty output. File at T311389