Page MenuHomePhabricator

Error related to initiatlizing RESTAPI/FetchHandler.php
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):
This issue was first observed through the REST Sandbox: https://test.wikipedia.org/wiki/Special:RestSandbox

  • Open the REST Sandbox on test wiki
  • Select "MediaWiki REST API (endpoints not in modules)" from the dropdown, if not already selected.
  • Hit "submit"
  • See 500 error (image paged)

image.png (650×1 px, 69 KB)

What happens?:

{
  "message": "Error: exception of type Wikimedia\\Rdbms\\DBQueryError: Error 1146: Table 'testwiki.wikilambda_zlanguages' doesn't exist\nFunction: MediaWiki\\Extension\\WikiLambda\\ZObjectStore::fetchAllZLanguageObjects\nQuery: SELECT DISTINCT wlzlangs_zid,wlzlangs_language  FROM `wikilambda_zlanguages`     ORDER BY wlzlangs_zid ASC \n",
  "exception": {
    "id": "dd2614da-62ee-42f3-a0a1-4b9b81f03947",
    "type": "Wikimedia\\Rdbms\\DBQueryError",
    "file": "/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php",
    "line": 1232,
    "message": "Error 1146: Table 'testwiki.wikilambda_zlanguages' doesn't exist\nFunction: MediaWiki\\Extension\\WikiLambda\\ZObjectStore::fetchAllZLanguageObjects\nQuery: SELECT DISTINCT wlzlangs_zid,wlzlangs_language  FROM `wikilambda_zlanguages`     ORDER BY wlzlangs_zid ASC \n",
    "code": 0,
    "url": "/w/rest.php/specs/v0/module/-",
    "caught_by": "other",
    "backtrace": [
      {
        "file": "/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php",
        "line": 1216,
        "function": "getQueryException",
        "class": "Wikimedia\\Rdbms\\Database",
        "type": "-\u003E",
        "args": [
          "string",
          "int",
          "string",
          "string"
        ]
      },

What should have happened instead?:
Wiki Lambda initiates correctly and the API specs render.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):
From James:

The problem specifically is that we can't (FWICT?) register the route conditionally based on an MW config flag, so we have to remember to check it ourselves in our execute method and exit, and we forgot for this one. Fix at FetchHandler: Disable on non-repo wikis (mediawiki/extensions/WikiLambda~1136775).

Event Timeline

Change #1136775 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] FetchHandler: Disable on non-repo wikis

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

Jdforrester-WMF changed the task status from Open to In Progress.Apr 15 2025, 7:18 PM
Jdforrester-WMF claimed this task.
Jdforrester-WMF triaged this task as Unbreak Now! priority.

Train blocker, per @HCoplin-WMF.

Change #1136775 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] FetchHandler: Disable on non-repo wikis

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

Change #1136801 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.24] FetchHandler: Disable on non-repo wikis

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

Change #1136802 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] FetchHandler: Disable on non-repo wikis

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

Change #1136806 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Change #1136806 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Change #1136807 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Change #1136808 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.24] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Change #1136802 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] FetchHandler: Disable on non-repo wikis

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

Change #1136801 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.24] FetchHandler: Disable on non-repo wikis

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

Change #1136807 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Change #1136808 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.24] FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either

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

Mentioned in SAL (#wikimedia-operations) [2025-04-15T20:48:44Z] <jforrester@deploy1003> Started scap sync-world: Backport for [[gerrit:1136802|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136807|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014)]], [[gerrit:1136801|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136808|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014)

Mentioned in SAL (#wikimedia-operations) [2025-04-15T21:27:22Z] <jforrester@deploy1003> jforrester: Backport for [[gerrit:1136802|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136807|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014)]], [[gerrit:1136801|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136808|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014)]] synced to

Mentioned in SAL (#wikimedia-operations) [2025-04-15T21:41:36Z] <jforrester@deploy1003> Finished scap sync-world: Backport for [[gerrit:1136802|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136807|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014)]], [[gerrit:1136801|FetchHandler: Disable on non-repo wikis (T392014)]], [[gerrit:1136808|FetchHandler: Don't read from the DB in getParamSettings on non-repo wikis either (T392014

Provisionally declaring Resolved, but please re-open if there are any issues.

Reedy subscribed.

Seems to be still happening on testwiki

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'testwiki.wikilambda_zlanguages' doesn't exist
Function: MediaWiki\Extension\WikiLambda\ZObjectStore::fetchAllZLanguageObjects
Query: SELECT DISTINCT wlzlangs_zid,wlzlangs_languag
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php(1232)
#0/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php(1216)Wikimedia\Rdbms\Database->getQueryException(string, int, string, string)
#1/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php(1190)Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, int, string, string)
#2/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php(647)Wikimedia\Rdbms\Database->reportQueryError(string, int, string, string, bool)
#3/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/Database.php(1367)Wikimedia\Rdbms\Database->query(Wikimedia\Rdbms\Query, string)
#4/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/DBConnRef.php(127)Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/database/DBConnRef.php(351)Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6/srv/mediawiki/php-1.44.0-wmf.25/includes/libs/rdbms/querybuilder/SelectQueryBuilder.php(762)Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7/srv/mediawiki/php-1.44.0-wmf.25/extensions/WikiLambda/includes/ZObjectStore.php(721)Wikimedia\Rdbms\SelectQueryBuilder->fetchResultSet()
#8/srv/mediawiki/php-1.44.0-wmf.25/extensions/WikiLambda/includes/ZObjectStore.php(737)MediaWiki\Extension\WikiLambda\ZObjectStore->fetchAllZLanguageObjects()
#9/srv/mediawiki/php-1.44.0-wmf.25/extensions/WikiLambda/includes/ActionAPI/ApiQueryZObjects.php(259)MediaWiki\Extension\WikiLambda\ZObjectStore->fetchAllZLanguageCodes()
#10/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiBase.php(1908)MediaWiki\Extension\WikiLambda\ActionAPI\ApiQueryZObjects->getAllowedParams(int)
#11/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiParamInfo.php(335)MediaWiki\Api\ApiBase->getFinalParams(int)
#12/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiParamInfo.php(153)MediaWiki\Api\ApiParamInfo->getModuleInfo(MediaWiki\Extension\WikiLambda\ActionAPI\ApiQueryZObjects)
#13/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiMain.php(2005)MediaWiki\Api\ApiParamInfo->execute()
#14/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiMain.php(947)MediaWiki\Api\ApiMain->executeAction()
#15/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiMain.php(918)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#16/srv/mediawiki/php-1.44.0-wmf.25/includes/api/ApiEntryPoint.php(152)MediaWiki\Api\ApiMain->execute()
#17/srv/mediawiki/php-1.44.0-wmf.25/includes/MediaWikiEntryPoint.php(202)MediaWiki\Api\ApiEntryPoint->execute()
#18/srv/mediawiki/php-1.44.0-wmf.25/api.php(44)MediaWiki\MediaWikiEntryPoint->run()
#19/srv/mediawiki/w/api.php(3)require(string)
#20{main}
Impact
Notes

Change #1137796 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either

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

Change #1137796 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either

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

Change #1138368 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either

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

Change #1138368 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@wmf/1.44.0-wmf.25] API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either

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

Mentioned in SAL (#wikimedia-operations) [2025-04-23T14:18:58Z] <jforrester@deploy1003> Started scap sync-world: Backport for [[gerrit:1137813|ZString: Don't explode if we're handed an array with odd contents (T392370)]], [[gerrit:1138368|API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either (T392014)]]

Mentioned in SAL (#wikimedia-operations) [2025-04-23T14:23:29Z] <jforrester@deploy1003> jforrester: Backport for [[gerrit:1137813|ZString: Don't explode if we're handed an array with odd contents (T392370)]], [[gerrit:1138368|API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either (T392014)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-04-23T14:30:28Z] <jforrester@deploy1003> Finished scap sync-world: Backport for [[gerrit:1137813|ZString: Don't explode if we're handed an array with odd contents (T392370)]], [[gerrit:1138368|API: Don't try to read fetchAllZLanguageCodes() in client-mode Action APIs either (T392014)]] (duration: 11m 29s)