Page MenuHomePhabricator

PropertyInfoSnakUrlExpander: Bad value for parameter $snak->getDataValue(): must be a DataValues\StringValue
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error message
Bad value for parameter $snak->getDataValue(): must be a DataValues\StringValue
Stack Trace
from /srv/mediawiki/php-1.36.0-wmf.27/vendor/wikimedia/assert/src/Assert.php(105)
#0 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/PropertyInfoSnakUrlExpander.php(40): Wikimedia\Assert\Assert::parameterType(array, Wikibase\DataModel\Entity\EntityIdValue, string)
#1 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Formatters/HtmlExternalIdentifierFormatter.php(51): Wikibase\Lib\PropertyInfoSnakUrlExpander->expandUrl(Wikibase\DataModel\Snak\PropertyValueSnak)
#2 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Formatters/DispatchingSnakFormatter.php(145): Wikibase\Lib\Formatters\HtmlExternalIdentifierFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#3 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/lib/includes/Formatters/ErrorHandlingSnakFormatter.php(67): Wikibase\Lib\Formatters\DispatchingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#4 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(438): Wikibase\Lib\Formatters\ErrorHandlingSnakFormatter->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak)
#5 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(385): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->formatSnak(Wikibase\DataModel\Snak\PropertyValueSnak, string)
#6 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(356): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->createQualifiersDiv(Wikibase\DataModel\Snak\SnakList)
#7 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(325): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->innerStatementDiv(Wikibase\DataModel\Statement\Statement)
#8 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(204): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->createStatementDiv(Wikibase\DataModel\Statement\Statement)
#9 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoEntityStatementsView.php(93): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->getLayoutForProperty(string, array)
#10 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoView.php(92): Wikibase\MediaInfo\View\MediaInfoEntityStatementsView->getHtml(Wikibase\MediaInfo\DataModel\MediaInfo)
#11 /srv/mediawiki/php-1.36.0-wmf.27/extensions/WikibaseMediaInfo/src/View/MediaInfoView.php(79): Wikibase\MediaInfo\View\MediaInfoView->getStatementsHtml(Wikibase\MediaInfo\DataModel\MediaInfo)
#12 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/repo/includes/ParserOutput/FullEntityParserOutputGenerator.php(195): Wikibase\MediaInfo\View\MediaInfoView->getContent(Wikibase\MediaInfo\DataModel\MediaInfo, integer)
#13 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/repo/includes/ParserOutput/FullEntityParserOutputGenerator.php(150): Wikibase\Repo\ParserOutput\FullEntityParserOutputGenerator->addHtmlToParserOutput(ParserOutput, Wikibase\Lib\Store\EntityRevision)
#14 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/repo/includes/ParserOutput/StatsdTimeRecordingEntityParserOutputGenerator.php(53): Wikibase\Repo\ParserOutput\FullEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#15 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/repo/includes/Content/EntityContent.php(238): Wikibase\Repo\ParserOutput\StatsdTimeRecordingEntityParserOutputGenerator->getParserOutput(Wikibase\Lib\Store\EntityRevision, boolean)
#16 /srv/mediawiki/php-1.36.0-wmf.27/extensions/Wikibase/repo/includes/Content/EntityContent.php(177): Wikibase\Repo\Content\EntityContent->getParserOutputFromEntityView(integer, ParserOptions, boolean)
#17 /srv/mediawiki/php-1.36.0-wmf.27/includes/Revision/RenderedRevision.php(266): Wikibase\Repo\Content\EntityContent->getParserOutput(Title, integer, ParserOptions, boolean)
#18 /srv/mediawiki/php-1.36.0-wmf.27/includes/Revision/RenderedRevision.php(235): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached(Wikibase\MediaInfo\Content\MediaInfoContent, boolean)
#19 /srv/mediawiki/php-1.36.0-wmf.27/includes/Revision/RevisionRenderer.php(230): MediaWiki\Revision\RenderedRevision->getSlotParserOutput(string, array)
#20 /srv/mediawiki/php-1.36.0-wmf.27/includes/Revision/RevisionRenderer.php(152): MediaWiki\Revision\RevisionRenderer->combineSlotOutput(MediaWiki\Revision\RenderedRevision, array)
#21 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}(MediaWiki\Revision\RenderedRevision, array)
#22 /srv/mediawiki/php-1.36.0-wmf.27/includes/Revision/RenderedRevision.php(197): call_user_func(Closure, MediaWiki\Revision\RenderedRevision, array)
#23 /srv/mediawiki/php-1.36.0-wmf.27/includes/poolcounter/PoolWorkArticleView.php(137): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#24 /srv/mediawiki/php-1.36.0-wmf.27/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleView->doWork()
#25 /srv/mediawiki/php-1.36.0-wmf.27/includes/page/ParserOutputAccess.php(260): PoolCounterWork->execute()
#26 /srv/mediawiki/php-1.36.0-wmf.27/includes/page/Article.php(762): MediaWiki\Page\ParserOutputAccess->getParserOutput(WikiFilePage, ParserOptions, MediaWiki\Revision\RevisionStoreCacheRecord, integer)
#27 /srv/mediawiki/php-1.36.0-wmf.27/includes/page/Article.php(575): Article->generateContentOutput(User, ParserOptions, integer, OutputPage, array)
#28 /srv/mediawiki/php-1.36.0-wmf.27/includes/page/ImagePage.php(153): Article->view()
#29 /srv/mediawiki/php-1.36.0-wmf.27/includes/actions/ViewAction.php(74): ImagePage->view()
#30 /srv/mediawiki/php-1.36.0-wmf.27/includes/MediaWiki.php(532): ViewAction->show()
#31 /srv/mediawiki/php-1.36.0-wmf.27/includes/MediaWiki.php(316): MediaWiki->performAction(ImagePage, Title)
#32 /srv/mediawiki/php-1.36.0-wmf.27/includes/MediaWiki.php(944): MediaWiki->performRequest()
#33 /srv/mediawiki/php-1.36.0-wmf.27/includes/MediaWiki.php(548): MediaWiki->main()
#34 /srv/mediawiki/php-1.36.0-wmf.27/index.php(53): MediaWiki->run()
#35 /srv/mediawiki/php-1.36.0-wmf.27/index.php(46): wfIndexMain()
#36 /srv/mediawiki/w/index.php(3): require(string)
#37 {main}
Impact

Seen once since deploying 1.36.0-wmf.27. Reproducible at URL:

MediaWiki internal error.

Original exception: [YAhekQpAAEYAACqxQaIAAADA] 2021-01-20 16:47:14: Fatal exception of type "Wikimedia\Assert\ParameterTypeException"

Exception caught inside exception handler.

Set $wgShowExceptionDetails = true; at the bottom of LocalSettings.php to show detailed debugging information.
Notes

Blocking train from rolling forward; not rolling back.

Details

Request ID
YAhZDj7LOpDAbE1X@FeimAAAARM
Request URL
https://test-commons.wikimedia.org/wiki/File:Broadcom_BCM92070MD_-_BCM20702-2427a.jpg

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
brennen triaged this task as Unbreak Now! priority.Jan 20 2021, 4:52 PM
brennen moved this task from Backlog to Logs/Train on the User-brennen board.
Ladsgroup subscribed.

This seems to be SDC issue not Wikidata

Adding EM of SDC. Forgive me if I'm wrong.

Adding EM of SDC. Forgive me if I'm wrong.

Thanks! I'm the PgM, @MarkTraceur is the EM. Our team is taking a look.

This error is happening in SDC code (MediaInfoEntityStatementsView->formatSnak(), but that code ultimately calls the Wikibase Snakformatter. The relevant part of our code has not changed in a while, FYI.

Seems like one of the following things could be happening here:

  • This could be a case of bad data for this particular file (not sure how to verify that)
  • The SDC code may need to be updated to include some additional guard to prevent it from even trying to attempt to format certain kinds of bad data (but then what should happen instead?)
  • The issue may be with the underlying SnakFormatter in Wikibase instead, especially if that code has changed more recently.

Here is the entity data for the relevant page (thanks @matthiasmullie): https://test-commons.wikimedia.org/wiki/Special:EntityData/M778.json. The stack trace implies that the problem may be qualifier-related, and there is only one set of qualifiers in the data (they are attached to P180, the depicts statement). Do we have a qualifier of value-type item where a string is expected?

Mentioned in SAL (#wikimedia-operations) [2021-01-20T20:06:29Z] <brennen> 1.36.0-wmf.27 (T271341) train status as of deploy window: currently blocked at group0 on T272508

I think this error is unrelated to 1.36.0-wmf.27.
The relevant code in WikibaseMediaInfo has not been touched in months, and it looks like the same is true for the calls to Wikidata code.

As far as I can tell, it is a valid error, because the data for that page is in fact invalid (and has been for months - it was last touched way back in November 2019)
The error should be obviously be handled in a much nicer way. Heck, it probably shouldn't even be possible to add this kind of faulty data (insofar it still is - we should check)
We definitely need to fix something here, but I don't think it's related to, or a blocker for the train.


More details:
The structured data for that page: https://test-commons.wikimedia.org/wiki/Special:EntityData/M778.json
Property P180 is present, which is the "depicts" property on production wikidata. Not test wikidata, which this instance is using.
And property P1419 ("shape" on production wikidata) is a nonsensical property of type "Point in time" in test wikidata (https://test.wikidata.org/wiki/Property:P1419), but it is here combined with an "entity-type":"item" value.
It looks like a structured data was added based on production wikidata properties & entities, which now obviously fails to render because, well, that data makes no sense with testwikidata data.

brennen lowered the priority of this task from Unbreak Now! to Needs Triage.Jan 20 2021, 8:21 PM

Thanks - makes sense. I'll proceed with wmf.27 to group1 and monitor just in case.

Change 657874 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Catch formatting errors and show something useful instead

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

Under normal conditions, it is not possible to submit invalid values like the one encountered here.
I suspect there must've been a federation configuration issue >1y ago where test-commons thought it was linked to production wikidata rather than testwikidata, thus allowing this invalid data.
Either way, I have a patch that should handle these kind of issues (that don't usually seem possible in the first place) in a more graceful way, and allows for fixing the invalid data.

Change 657874 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Catch formatting errors and show something useful instead

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

Etonkovidova removed matthiasmullie as the assignee of this task.
Etonkovidova subscribed.

Checked in wmf.30 - the error is not present.