Page MenuHomePhabricator

WikibaseLexeme: Call to a member function getLemmas() on null
Closed, ResolvedPublic5 Estimated Story PointsPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.33

message
Call to a member function getLemmas() on null

Impact

Certain API data inaccessible. Reproducible for the items that can be found in the log under this request ID.

Notes

6 of these in the last 12 hours or so.

Acceptance Criteria⛺✨ :

  • In cases when this error would occur, we correctly handle the situation

Details

Request ID
YEiKJ7kNnouwdoFdYEeATgAAAAc
Request URL
https://www.wikidata.org/w/api.php?action=wbcheckconstraints&format=json&formatversion=2&uselang=en&id=Q105821396&status=violation|warning|suggestion|bad-parameters
Stack Trace
exception.trace
from /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseLexeme/src/Presentation/Formatters/LexemeIdHtmlFormatter.php(65)
#0 /srv/mediawiki/php-1.36.0-wmf.33/extensions/Wikibase/lib/includes/Formatters/DispatchingEntityIdHtmlLinkFormatter.php(48): Wikibase\Lexeme\Presentation\Formatters\LexemeIdHtmlFormatter->formatEntityId(Wikibase\Lexeme\Domain\Model\LexemeId)
#1 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/ViolationMessageRenderer.php(214): Wikibase\Lib\Formatters\DispatchingEntityIdHtmlLinkFormatter->formatEntityId(Wikibase\Lexeme\Domain\Model\LexemeId)
#2 [internal function]: WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRenderer->renderEntityId(Wikibase\Lexeme\Domain\Model\LexemeId, string)
#3 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/ViolationMessageRenderer.php(176): array_map(array, array, array)
#4 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/ViolationMessageRenderer.php(225): WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRenderer->renderList(array, string, array)
#5 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/ViolationMessageRenderer.php(143): WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRenderer->renderEntityIdList(array, string)
#6 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/ViolationMessageRenderer.php(84): WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRenderer->renderArgument(array)
#7 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/ConstraintCheck/Message/MultilingualTextViolationMessageRenderer.php(59): WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessageRenderer->render(WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessage)
#8 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/Api/CheckResultsRenderer.php(94): WikibaseQuality\ConstraintReport\ConstraintCheck\Message\MultilingualTextViolationMessageRenderer->render(WikibaseQuality\ConstraintReport\ConstraintCheck\Message\ViolationMessage)
#9 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/Api/CheckResultsRenderer.php(56): WikibaseQuality\ConstraintReport\Api\CheckResultsRenderer->checkResultToArray(WikibaseQuality\ConstraintReport\ConstraintCheck\Result\CheckResult)
#10 /srv/mediawiki/php-1.36.0-wmf.33/extensions/WikibaseQualityConstraints/src/Api/CheckConstraints.php(172): WikibaseQuality\ConstraintReport\Api\CheckResultsRenderer->render(WikibaseQuality\ConstraintReport\ConstraintCheck\Cache\CachedCheckResults)
#11 /srv/mediawiki/php-1.36.0-wmf.33/includes/api/ApiMain.php(1612): WikibaseQuality\ConstraintReport\Api\CheckConstraints->execute()
#12 /srv/mediawiki/php-1.36.0-wmf.33/includes/api/ApiMain.php(591): ApiMain->executeAction()
#13 /srv/mediawiki/php-1.36.0-wmf.33/includes/api/ApiMain.php(562): ApiMain->executeActionWithErrorHandling()
#14 /srv/mediawiki/php-1.36.0-wmf.33/api.php(90): ApiMain->execute()
#15 /srv/mediawiki/php-1.36.0-wmf.33/api.php(45): wfApiMain()
#16 /srv/mediawiki/w/api.php(3): require(string)
#17 {main}

Event Timeline

		/** @var Lexeme $lexeme */
		$lexeme = $this->entityLookup->getEntity( $id );
		'@phan-var Lexeme $lexeme';

		$lemmas = $lexeme->getLemmas(); # <!-- Failing here

Wikibase\DataModel\Services\Lookup\EntityLookup::getEntity is documented to return null

But there is no recent code changes around it (as far I can see)

Lucas_Werkmeister_WMDE changed Request URL from https://www.wikidata.org/w/api.php?action=wbcheckconstraints&format=json&formatversion=2&uselang=en&id=[id]&status=violation|warning|suggestion|bad-parameters to https://www.wikidata.org/w/api.php?action=wbcheckconstraints&format=json&formatversion=2&uselang=en&id=Q105821396&status=violation|warning|suggestion|bad-parameters.Mar 16 2021, 11:08 AM

Q105821396 is the only affected item ID found in logstash. The issue also hasn’t reappeared since March 11.

The issue also hasn’t reappeared since March 11.

It might have gone away if this was recently touched (not sure if it was), but probably worth a quick check to see if the code and still get into this situation.

Possible related T173287 which could relate to LexemeIdHtmlFormatter not handeling deleted lexemes.
It could be that this is meant to be handled further up the the stacktrace here, (or also in the other ticket), such as in DispatchingEntityIdHtmlLinkFormatter
How this is wired up for properties and items etc should be checked

noarave set the point value for this task to 5.Apr 7 2021, 10:53 AM

It's in this lexeme https://www.wikidata.org/w/index.php?title=Lexeme:L456103&action=history

basically, you create statement with value of a lexeme and then delete that lexeme, and here we are. I'll try to see what can be done.

Change 679697 had a related patch set uploaded (by Ladsgroup; author: Ladsgroup):

[mediawiki/extensions/WikibaseLexeme@master] Show a message instead of fatal when the lexeme doesn't exist

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

Change 679697 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Show a message instead of fatal when the lexeme doesn't exist

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

Has anyone checked what's the state with links to a deleted Form or Sense?

Yes. I did. It woks fine there.

I don't mind closing tickets for wikidata, etc. but since it's on the general production error board (Wikimedia-production-error ), if we close it before it gets deployed, people at WMF might make new duplicate tickets with this. I can backport it too.