Page MenuHomePhabricator

Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist
Function: MediaWiki\Storage\NameTableStore::loadTable
Query: SELECT  wby_id AS `id`,wby_name AS `name`  FROM `wbt_type`     ORDER BY id
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/Database.php(1523)
#0 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/Database.php(1507): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/Database.php(1481): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/Database.php(854): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/Database.php(1628): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/DBConnRef.php(119): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/database/DBConnRef.php(344): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(652): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.41.0-wmf.2/includes/Storage/NameTableStore.php(375): Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#8 /srv/mediawiki/php-1.41.0-wmf.2/includes/Storage/NameTableStore.php(351): MediaWiki\Storage\NameTableStore->loadTable(Wikimedia\Rdbms\DBConnRef)
#9 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/objectcache/wancache/WANObjectCache.php(1756): MediaWiki\Storage\NameTableStore->MediaWiki\Storage\{closure}(boolean, integer, array, NULL, array)
#10 /srv/mediawiki/php-1.41.0-wmf.2/includes/libs/objectcache/wancache/WANObjectCache.php(1586): WANObjectCache->fetchOrRegenerate(string, integer, Closure, array, array)
#11 /srv/mediawiki/php-1.41.0-wmf.2/includes/Storage/NameTableStore.php(352): WANObjectCache->getWithSetCallback(string, integer, Closure)
#12 /srv/mediawiki/php-1.41.0-wmf.2/includes/Storage/NameTableStore.php(254): MediaWiki\Storage\NameTableStore->getTableFromCachesOrReplica()
#13 /srv/mediawiki/php-1.41.0-wmf.2/extensions/Wikibase/lib/includes/Store/Sql/Terms/DatabaseTypeIdsStore.php(65): MediaWiki\Storage\NameTableStore->getId(string)
#14 /srv/mediawiki/php-1.41.0-wmf.2/extensions/Wikibase/repo/includes/Store/Sql/Terms/DatabaseTermsCollisionDetector.php(94): Wikibase\Lib\Store\Sql\Terms\DatabaseTypeIdsStore->lookupTypeIds(array)
#15 /srv/mediawiki/php-1.41.0-wmf.2/extensions/Wikibase/repo/includes/Specials/SpecialNewItem.php(333): Wikibase\Repo\Store\Sql\Terms\DatabaseTermsCollisionDetector->detectLabelAndDescriptionCollision(string, string, string)
#16 /srv/mediawiki/php-1.41.0-wmf.2/extensions/Wikibase/repo/includes/Specials/SpecialNewEntity.php(153): Wikibase\Repo\Specials\SpecialNewItem->validateFormData(array)
#17 /srv/mediawiki/php-1.41.0-wmf.2/includes/htmlform/HTMLForm.php(744): Wikibase\Repo\Specials\SpecialNewEntity->Wikibase\Repo\Specials\{closure}(array, OOUIHTMLForm)
#18 /srv/mediawiki/php-1.41.0-wmf.2/includes/htmlform/HTMLForm.php(624): HTMLForm->trySubmit()
#19 /srv/mediawiki/php-1.41.0-wmf.2/extensions/Wikibase/repo/includes/Specials/SpecialNewEntity.php(111): HTMLForm->tryAuthorizedSubmit()
#20 /srv/mediawiki/php-1.41.0-wmf.2/includes/specialpage/SpecialPage.php(701): Wikibase\Repo\Specials\SpecialNewEntity->execute(NULL)
#21 /srv/mediawiki/php-1.41.0-wmf.2/includes/specialpage/SpecialPageFactory.php(1491): SpecialPage->run(NULL)
#22 /srv/mediawiki/php-1.41.0-wmf.2/includes/MediaWiki.php(328): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#23 /srv/mediawiki/php-1.41.0-wmf.2/includes/MediaWiki.php(926): MediaWiki->performRequest()
#24 /srv/mediawiki/php-1.41.0-wmf.2/includes/MediaWiki.php(579): MediaWiki->main()
#25 /srv/mediawiki/php-1.41.0-wmf.2/index.php(50): MediaWiki->run()
#26 /srv/mediawiki/php-1.41.0-wmf.2/index.php(46): wfIndexMain()
#27 /srv/mediawiki/w/index.php(3): require(string)
#28 {main}
Impact

Moderate amount of logspam. The request is not valid (you cannot have items on Commons), so there’s no real user impact – someone’s trying to do something that shouldn’t work, the error just isn’t caught properly.

Notes

We previously fixed an API version of this in T242959: Internal API errors when trying to edit Wikidata entities from Commons, but it’s not clear if the error from Special:NewItem is a regression or was never addressed to begin with.

Details

Request URL
https://commons.wikimedia.org/wiki/Special:NewItem

Event Timeline

This is the kind of task where having a Test Commons wiki is really useful, by the way. Right now this can still be reproduced on https://test-commons.wikimedia.org/wiki/Special:NewItem; once T213295 happens, that will no longer be possible.

Lucas_Werkmeister_WMDE renamed this task from Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't existFunction: MediaWiki\Storage\NameTableStore::loadTableQuery: SELECT wby_id AS `id`,wby_name AS `name` FROM `wbt_type` ORDER BY id to Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons.Mar 30 2023, 3:44 PM

Hm, now I’m no longer so sure that this is a regression at all… apparently it’s been happening for a while, just not very often.

image.png (355×607 px, 27 KB)

@thcipriani originally brought up these log messages in the context of T242959: Internal API errors when trying to edit Wikidata entities from Commons, and I thought it was a regression, but all the patches attached to that task are about API modules. It’s possible that we just never fixed this for special pages before.

Task Review notes:

  • We believe the issue stems from code in WikibaseRepo (which handles entity creation in a Wikibase)
  • The proper solution here would be to handle this edge case with a nicer error

Prio Notes:

  • Might affect production (but not end users, just logspam)
  • Does not affect development efforts
  • Does not affect onboarding efforts
  • Does affect additional stakeholders (logspam)

Story Writing Notes:

  • While one solution is to simply disable access to Special:NewItem, we would also want to make sure to handle this case where an invalid action is trying to be preformed on the database, even before it reaches the database error level.
  • Add AC to ensure that this edge case is handled with an error message.
ItamarWMDE renamed this task from Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons to [SW] Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons.Apr 12 2023, 12:28 PM

This is the kind of task where having a Test Commons wiki is really useful, by the way. Right now this can still be reproduced on https://test-commons.wikimedia.org/wiki/Special:NewItem; once T213295 happens, that will no longer be possible.

We have Beta Cluster for testing.

ItamarWMDE renamed this task from [SW] Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons to Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'commonswiki.wbt_type' doesn't exist when using Special:NewItem on Commons.May 10 2023, 3:12 PM
ItamarWMDE removed a project: Wikidata Dev Team.
ItamarWMDE moved this task from [DOT] Prioritized to Epics on the wmde-wikidata-tech board.