Page MenuHomePhabricator

TypeError: MediaWiki\Api\ApiAuthManagerHelper::formatMessage(): Argument #3 ($message) must be of type MediaWiki\Message\Message, null given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
  • service.version: 1.46.0-wmf.22
  • timestamp: 2026-04-01T13:12:55.195Z
  • labels.phpversion: 8.3.30
  • trace.id: d7bad1e6-4d76-455c-b3a5-9652c16c55aa
  • Find trace.id in Logstash
labels.normalized_message
[{reqId}] {exception_url}   TypeError: MediaWiki\Api\ApiAuthManagerHelper::formatMessage(): Argument #3 ($message) must be of type MediaWiki\Message\Message, null given, called in /srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiAuthManagerHelper.php on l
FrameLocationCall
from/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiAuthManagerHelper.php(73)
#0/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiAuthManagerHelper.php(339)MediaWiki\Api\ApiAuthManagerHelper->formatMessage(array, string, null)
#1/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiAuthManagerHelper.php(301)MediaWiki\Api\ApiAuthManagerHelper->formatFields(array)
#2/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiQueryAuthManagerInfo.php(80)MediaWiki\Api\ApiAuthManagerHelper->formatRequests(array)
#3/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiQuery.php(735)MediaWiki\Api\ApiQueryAuthManagerInfo->execute()
#4/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiMain.php(2059)MediaWiki\Api\ApiQuery->execute()
#5/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiMain.php(964)MediaWiki\Api\ApiMain->executeAction()
#6/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiMain.php(935)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#7/srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiEntryPoint.php(138)MediaWiki\Api\ApiMain->execute()
#8/srv/mediawiki/php-1.46.0-wmf.22/includes/MediaWikiEntryPoint.php(180)MediaWiki\Api\ApiEntryPoint->execute()
#9/srv/mediawiki/php-1.46.0-wmf.22/api.php(30)MediaWiki\MediaWikiEntryPoint->run()
#10/srv/mediawiki/w/api.php(3)require(string)
#11{main}
Notes

Low volume.

Started with 1.46.0-wmf.22.

I can't see any recent changes in the affected code that may explain the regression

Details

Request URL
https://ca.wikipedia.org/w/api.php?action=query&amirequestsfor=*&errorformat=*&errorsuselocal=*&format=*&formatversion=*&meta=*
Related Changes in Gerrit:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
matmarex subscribed.

Probably a bug in one of the auth extensions. Maybe OATHAuth, there were a lot of changes there recently.

Probably rEOAT5dc1b42b2e21: Auth: Stop using AuthenticationResponse::newUI() to display "warnings" because we're removing the label... And rMWec832d4ca548: AuthenticationResponse: Allow newUI() to accept null for $msg which started allowing null to be passed in...

Which seems to work fine for the UI, just this is causing issues via the API.

So probably a change to ApiAuthManagerHelper to handle said null...

And then see if we should actually probably be displaying something to the API...

I can reproduce locally after enabling $wgOATHPasswordlessLogin.

matmarex triaged this task as Unbreak Now! priority.EditedApr 1 2026, 6:36 PM

This is likely going to break logins on the iOS and Android Wikipedia apps, which use this API (https://codesearch.wmcloud.org/search/?q=amirequestsfor).

Change #1266351 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] ApiAuthManagerHelper: Accept fields with undefined label

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

matmarex renamed this task from TypeError: MediaWiki\Api\ApiAuthManagerHelper::formatMessage(): Argument #3 ($message) must be of type MediaWiki\Message\Message, null given, called in /srv/mediawiki/php-1.46.0-wmf.22/includes/Api/ApiAuthManagerHelper.php on l to TypeError: MediaWiki\Api\ApiAuthManagerHelper::formatMessage(): Argument #3 ($message) must be of type MediaWiki\Message\Message, null given.Apr 1 2026, 6:50 PM

Change #1266351 merged by jenkins-bot:

[mediawiki/core@master] ApiAuthManagerHelper: Accept fields with undefined label

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

Change #1266861 had a related patch set uploaded (by Jaime Nuche; author: Bartosz Dziewoński):

[mediawiki/core@wmf/1.46.0-wmf.22] ApiAuthManagerHelper: Accept fields with undefined label

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

Change #1266861 merged by jenkins-bot:

[mediawiki/core@wmf/1.46.0-wmf.22] ApiAuthManagerHelper: Accept fields with undefined label

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

Mentioned in SAL (#wikimedia-operations) [2026-04-02T07:41:06Z] <jnuche@deploy1003> Started scap sync-world: Backport for [[gerrit:1266861|ApiAuthManagerHelper: Accept fields with undefined label (T422027)]]

Mentioned in SAL (#wikimedia-operations) [2026-04-02T07:43:08Z] <jnuche@deploy1003> jnuche: Backport for [[gerrit:1266861|ApiAuthManagerHelper: Accept fields with undefined label (T422027)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-04-02T07:47:55Z] <jnuche@deploy1003> Finished scap sync-world: Backport for [[gerrit:1266861|ApiAuthManagerHelper: Accept fields with undefined label (T422027)]] (duration: 06m 39s)

jnuche lowered the priority of this task from Unbreak Now! to Needs Triage.Apr 2 2026, 7:49 AM

I've backported the fix. Thank you for the patch @matmarex