Page MenuHomePhabricator

InvalidArgumentException when requesting Special:EntityData with Sense or Form ID (The given ID does not refer to an entity of type lexeme)
Closed, ResolvedPublic8 Estimated Story PointsPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.20

message
The given ID does not refer to an entity of type lexeme

Impact

About 4 logstash events per day since the late UTC evening of December 4th, prior to that only sporadic occurrences. Affects both wmf.18 and wmf.20.

Notes

T195110: Special:EntityData throws an exception when called with a form id indicates that this used to work (or at least we fixed it once).

Special:EntityData?id=L1-S1&format=json (ID in query params instead of path) produces the same error.

This happens only for IDs of existing Senses and Forms – e.g. Special:EntityData/L1-S1000.json returns “not found” without crashing.

Acceptance criteria

  • it should work again
  • there is an integration test in Lexeme for this (probably add another test to LexemeSpecialEntityDataTest, which currently only requests Special:EntityData with a Lexeme ID)

Details

Request ID
X84-@ApAEJcAAoTSUtMAAABA
Request URL
https://www.wikidata.org/wiki/Special:EntityData/L1-S1.json
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/Content/EntityContentFactory.php(127): Wikibase\Repo\Content\EntityHandler->getTitleForId(Wikibase\Lexeme\Domain\Model\SenseId)
#1 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/Api/ResultBuilder.php(344): Wikibase\Repo\Content\EntityContentFactory->getTitleForId(Wikibase\Lexeme\Domain\Model\SenseId)
#2 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/Api/ResultBuilder.php(308): Wikibase\Repo\Api\ResultBuilder->addPageInfoToRecord(array, Wikibase\Lib\Store\EntityRevision)
#3 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(397): Wikibase\Repo\Api\ResultBuilder->addEntityRevision(string, Wikibase\Lib\Store\EntityRevision)
#4 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(425): Wikibase\Repo\LinkedData\EntityDataSerializationService->generateApiResult(Wikibase\Lib\Store\EntityRevision, ApiFormatJson)
#5 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/LinkedData/EntityDataSerializationService.php(155): Wikibase\Repo\LinkedData\EntityDataSerializationService->getApiSerialization(Wikibase\Lib\Store\EntityRevision, ApiFormatJson)
#6 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(521): Wikibase\Repo\LinkedData\EntityDataSerializationService->getSerializedData(string, Wikibase\Lib\Store\EntityRevision, NULL, array, NULL)
#7 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/LinkedData/EntityDataRequestHandler.php(267): Wikibase\Repo\LinkedData\EntityDataRequestHandler->showData(WebRequest, OutputPage, string, Wikibase\Lexeme\Domain\Model\SenseId, integer)
#8 /srv/mediawiki/php-1.36.0-wmf.20/extensions/Wikibase/repo/includes/Specials/SpecialEntityData.php(115): Wikibase\Repo\LinkedData\EntityDataRequestHandler->handleRequest(string, WebRequest, OutputPage)
#9 /srv/mediawiki/php-1.36.0-wmf.20/includes/specialpage/SpecialPage.php(645): Wikibase\Repo\Specials\SpecialEntityData->execute(string)
#10 /srv/mediawiki/php-1.36.0-wmf.20/includes/specialpage/SpecialPageFactory.php(1402): SpecialPage->run(string)
#11 /srv/mediawiki/php-1.36.0-wmf.20/includes/MediaWiki.php(310): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#12 /srv/mediawiki/php-1.36.0-wmf.20/includes/MediaWiki.php(945): MediaWiki->performRequest()
#13 /srv/mediawiki/php-1.36.0-wmf.20/includes/MediaWiki.php(548): MediaWiki->main()
#14 /srv/mediawiki/php-1.36.0-wmf.20/index.php(53): MediaWiki->run()
#15 /srv/mediawiki/php-1.36.0-wmf.20/index.php(46): wfIndexMain()
#16 /srv/mediawiki/w/index.php(3): require(string)
#17 {main}

Event Timeline

Mentioned in SAL (#wikimedia-operations) [2020-12-09T20:18:10Z] <twentyafterfour> wmf.21 looks good on group1 wikis. Still seeing T269603 but not at an increased rate. (refs T264801)

Prio Notes: Started of split 3,4,11,15. We believe it was recently broken and likely easy to fix quickly we pushed it toward the top of the list

Okay, the issue is that the ResultBuilder now has an entityTitleLookup that is an EntityContentFactory, which used to be a TypeDispatchingEntityTitleStoreLookup that would dispatch to a specific SenseTitleStoreLookup. In other words – that change merged the EntityTitleLookup service with the EntityContentFactory service, since EntityContentFactory implements EntityTitleLookup, but in fact we need a better EntityTitleLookup.

Change 657550 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/Wikibase@master] Avoid using EntityContentFactory as EntityTitleLookup

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

Change 658245 had a related patch set uploaded (by Lucas Werkmeister (WMDE); owner: Lucas Werkmeister (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Add test for Special:EntityData with Sense/Form ID

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

Change 657550 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Avoid using EntityContentFactory as EntityTitleLookup

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

Change 658245 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Add test for Special:EntityData with Sense/Form ID

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

Will be deployed this week.
Can then be verified with the example in the description

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