Page MenuHomePhabricator

Fatal error from action=wbgetentities API for certain batch requests
Closed, ResolvedPublic

Description

Error

Request URL: GET commonswiki /w/api.php?action=wbgetentities&titles=File:Pluto_in_True_Color_-_High-Res.jpg|File:New_Horizons_Transparent.png%20]&sites=commonswiki&props=labels
Request ID: XPMv3gpAAEEAAG57HtYAAAAR

message
BadMethodCallException: Call to a member function inNamespace() on a non-object (null)
trace
#0 /srv/mediawiki/php-1.34.0-wmf.7/extensions/Wikibase/repo/includes/Api/EntityByTitleHelper.php(130): Wikibase\MediaInfo\Services\MediaInfoByLinkedTitleLookup->getEntityIdForLinkedTitle(string, string)
#1 /srv/mediawiki/php-1.34.0-wmf.7/extensions/Wikibase/repo/includes/Api/EntityByTitleHelper.php(106): Wikibase\Repo\Api\EntityByTitleHelper->getEntityId(string, string, boolean)
#2 /srv/mediawiki/php-1.34.0-wmf.7/extensions/Wikibase/repo/includes/Api/GetEntities.php(198): Wikibase\Repo\Api\EntityByTitleHelper->getEntityIds(array, array, boolean)
#3 /srv/mediawiki/php-1.34.0-wmf.7/extensions/Wikibase/repo/includes/Api/GetEntities.php(154): Wikibase\Repo\Api\GetEntities->getEntityIdsFromSiteTitleParams(array)
#4 /srv/mediawiki/php-1.34.0-wmf.7/extensions/Wikibase/repo/includes/Api/GetEntities.php(131): Wikibase\Repo\Api\GetEntities->getEntityIdsFromParams(array)
#5 /srv/mediawiki/php-1.34.0-wmf.7/includes/api/ApiMain.php(1595): Wikibase\Repo\Api\GetEntities->execute()
#6 /srv/mediawiki/php-1.34.0-wmf.7/includes/api/ApiMain.php(531): ApiMain->executeAction()
#7 /srv/mediawiki/php-1.34.0-wmf.7/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#8 /srv/mediawiki/php-1.34.0-wmf.7/api.php(87): ApiMain->execute()
{
    "error": {
        "code": "internal_api_error_BadMethodCallException",
        "info": "[XPMv3gpAAEEAAG57HtYAAAAR] Caught exception of type BadMethodCallException",
        "errorclass": "BadMethodCallException"
    },}

Impact

(Undetermined).

Notes

The error exists since at least 1.34-wmf.3, possibly earlier.

It looks like the the MediaInfoByLinkedTitleLookup class provided by WikibaseMediaInfo is forgetting to validate a title somewhere prior to use, causing this null value to sneak through and causing a fatal error when later code assumes it to be a valid Title object.

Event Timeline

Krinkle created this task.Jun 2 2019, 2:12 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 2 2019, 2:12 AM
Restricted Application added a project: Wikidata. · View Herald TranscriptJun 2 2019, 2:40 PM

Change 514259 had a related patch set uploaded (by Matthias Mullie; owner: Matthias Mullie):
[mediawiki/extensions/WikibaseMediaInfo@master] Gracefully handle invalid titles

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

Ramsey-WMF triaged this task as High priority.Jun 4 2019, 3:52 PM
Ramsey-WMF moved this task from To Do to Doing on the Structured Data Engineering board.
Ramsey-WMF moved this task from Untriaged to Next up on the Multimedia board.

Change 514259 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Gracefully handle invalid titles

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

matthiasmullie closed this task as Resolved.Jun 12 2019, 4:12 PM
mmodell changed the subtype of this task from "Task" to "Production Error".Wed, Aug 28, 11:06 PM
Restricted Application added a project: Structured-Data-Backlog. · View Herald TranscriptWed, Aug 28, 11:06 PM