Page MenuHomePhabricator

InvalidArgumentException: Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field wbtl_type_id
Closed, ResolvedPublicPRODUCTION ERROR

Description

API query to reproduce the error on most Wikibase wikis (should work with an Item namespace or with items in the main namespace): api.php?action=query&generator=allpages&prop=pageterms|entityterms&wbptterms=&wbetterms=

Error
normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Wikimedia\Rdbms\Platform\SQLPlatform::makeList: empty input for field wbtl_type_id
exception.trace
from /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/platform/SQLPlatform.php(257)
#0 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/platform/SQLPlatform.php(724): Wikimedia\Rdbms\Platform\SQLPlatform->makeList(array, integer)
#1 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/database/Database.php(3292): Wikimedia\Rdbms\Platform\SQLPlatform->selectSQLText(array, array, array, string, array, array)
#2 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/database/DatabaseMySQL.php(644): Wikimedia\Rdbms\Database->selectSQLText(array, array, array, string, array, array)
#3 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/database/Database.php(1333): Wikimedia\Rdbms\DatabaseMySQL->selectSQLText(array, array, array, string, array, array)
#4 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(127): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/database/DBConnRef.php(351): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.43.0-wmf.14/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(746): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/lib/includes/Store/Sql/Terms/DatabaseTermInLangIdsResolver.php(145): Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#8 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/lib/includes/Store/Sql/Terms/PrefetchingEntityTermLookupBase.php(101): Wikibase\Lib\Store\Sql\Terms\DatabaseTermInLangIdsResolver->resolveTermsViaJoin(string, string, string, array, array, array)
#9 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/lib/includes/Store/Sql/Terms/PrefetchingEntityTermLookupBase.php(92): Wikibase\Lib\Store\Sql\Terms\PrefetchingEntityTermLookupBase->resolveTerms(array, array, array)
#10 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/data-access/src/SourceAndTypeDispatchingPrefetchingTermLookup.php(41): Wikibase\Lib\Store\Sql\Terms\PrefetchingEntityTermLookupBase->prefetchTerms(array, array, array)
#11 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/repo/includes/Api/EntityTerms.php(105): Wikibase\DataAccess\SourceAndTypeDispatchingPrefetchingTermLookup->prefetchTerms(array, array, array)
#12 /srv/mediawiki/php-1.43.0-wmf.14/extensions/Wikibase/repo/includes/Api/EntityTerms.php(90): Wikibase\Repo\Api\EntityTerms->getTermsOfEntities(array, array, string)
#13 /srv/mediawiki/php-1.43.0-wmf.14/includes/api/ApiQuery.php(707): Wikibase\Repo\Api\EntityTerms->execute()
#14 /srv/mediawiki/php-1.43.0-wmf.14/includes/api/ApiMain.php(1953): ApiQuery->execute()
#15 /srv/mediawiki/php-1.43.0-wmf.14/includes/api/ApiMain.php(929): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.43.0-wmf.14/includes/api/ApiMain.php(900): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.43.0-wmf.14/includes/api/ApiEntryPoint.php(158): ApiMain->execute()
#18 /srv/mediawiki/php-1.43.0-wmf.14/includes/MediaWikiEntryPoint.php(200): MediaWiki\Api\ApiEntryPoint->execute()
#19 /srv/mediawiki/php-1.43.0-wmf.14/api.php(44): MediaWiki\MediaWikiEntryPoint->run()
#20 /srv/mediawiki/w/api.php(3): require(string)
#21 {main}
Impact

Not yet clear. Broken search?

Notes

Details

Request URL
https://www.wikidata.org/w/api.php?action=query&format=json&formatversion=2&generator=wbsearch&gwbslimit=15&gwbsnamespace=0&gwbssearch=1&pilimit=15&piprop=thumbnail&pithumbsize=120&ppprop=displaytitle&prop=pageprops%7Centityterms%7Cpageimages%7Cdescription&redirects=&wbetterms=label%27%22%5C%28
Related Changes in Gerrit:

Event Timeline

Okay, apparently the &wbetterms= value is invalid (it decodes to label'"\(), so the API warns and discards it; and using empty &wbetterms= subsequently results in the error (and you can also reproduce this with just &wbetterms= on its own).

Maybe also worth checking where this broken API request comes from – the referrer is https://m.wikidata.org/wiki/Wikidata:Main_Page.

Change #1056167 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Require nonempty term types in APIs

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

Maybe also worth checking where this broken API request comes from – the referrer is https://m.wikidata.org/wiki/Wikidata:Main_Page.

I haven’t been able to figure this out – none of the code in codesearch or in the User/MediaWiki namespaces on-wiki seems to have a dynamic wbetterms= parameter. According to Logstash, this has been happening at lower volumes for a while already (screenshot shows the past 90 days of mediawiki-errors for "wbtl_type_id" AND "makeList"), with a larger spike today just as I happened to look at logspam-watch. I think we can just fix the internal error and let others fix their API calls.

image.png (300×680 px, 17 KB)

Change #1056167 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Require nonempty term types in APIs

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

Lucas_Werkmeister_WMDE claimed this task.

Seems to be done, the request URL no longer produces an error.