Page MenuHomePhabricator

ArgumentCountError: Too few arguments to function MediaWiki\Extension\Gadgets\GadgetRepo::titleWithoutPrefix(), 1 passed in /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetResourceLoaderModule.php on line 80
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   ArgumentCountError: Too few arguments to function MediaWiki\Extension\Gadgets\GadgetRepo::titleWithoutPrefix(), 1 passed in /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetResourceLoaderModule.php on line 80
error.stack_trace
from /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetRepo.php(92)
#0 /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetResourceLoaderModule.php(80): MediaWiki\Extension\Gadgets\GadgetRepo->titleWithoutPrefix(string)
#1 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/WikiModule.php(368): MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule->getRequireKey(string)
#2 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/WikiModule.php(294): MediaWiki\ResourceLoader\WikiModule->getPackageFiles(MediaWiki\ResourceLoader\Context)
#3 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/Module.php(839): MediaWiki\ResourceLoader\WikiModule->getScript(MediaWiki\ResourceLoader\Context)
#4 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/Module.php(808): MediaWiki\ResourceLoader\Module->buildContent(MediaWiki\ResourceLoader\Context)
#5 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1273): MediaWiki\ResourceLoader\Module->getModuleContent(MediaWiki\ResourceLoader\Context)
#6 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1197): MediaWiki\ResourceLoader\ResourceLoader->addOneModuleResponse(MediaWiki\ResourceLoader\Context, Wikimedia\Minify\IdentityMinifierState, string, MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule, array)
#7 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1115): MediaWiki\ResourceLoader\ResourceLoader->getOneModuleResponse(MediaWiki\ResourceLoader\Context, string, MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule)
#8 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(827): MediaWiki\ResourceLoader\ResourceLoader->makeModuleResponse(MediaWiki\ResourceLoader\Context, array, array)
#9 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoaderEntryPoint.php(53): MediaWiki\ResourceLoader\ResourceLoader->respond(MediaWiki\ResourceLoader\Context)
#10 /srv/mediawiki/php-1.42.0-wmf.21/includes/MediaWikiEntryPoint.php(199): MediaWiki\ResourceLoader\ResourceLoaderEntryPoint->execute()
#11 /srv/mediawiki/php-1.42.0-wmf.21/load.php(42): MediaWiki\MediaWikiEntryPoint->run()
#12 /srv/mediawiki/w/load.php(3): require(string)
#13 {main}
Impact

Being an error in the Gadgets extension, I am worried about the impact on users if we roll out the train to group1.

Notes

First seen in group0 during train of 1.42.0-wmf.21. The error rate is irregular (probably low volume and user-driven) but sustained.

The backtrace above belongs to test Wikidata but the error is also visible for maintenance servers:

from /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetRepo.php(92)
#0 /srv/mediawiki/php-1.42.0-wmf.21/extensions/Gadgets/includes/GadgetResourceLoaderModule.php(80): MediaWiki\Extension\Gadgets\GadgetRepo->titleWithoutPrefix(string)
#1 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/WikiModule.php(368): MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule->getRequireKey(string)
#2 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/WikiModule.php(294): MediaWiki\ResourceLoader\WikiModule->getPackageFiles(MediaWiki\ResourceLoader\DerivativeContext)
#3 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/Module.php(839): MediaWiki\ResourceLoader\WikiModule->getScript(MediaWiki\ResourceLoader\DerivativeContext)
#4 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/Module.php(808): MediaWiki\ResourceLoader\Module->buildContent(MediaWiki\ResourceLoader\DerivativeContext)
#5 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1273): MediaWiki\ResourceLoader\Module->getModuleContent(MediaWiki\ResourceLoader\DerivativeContext)
#6 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1197): MediaWiki\ResourceLoader\ResourceLoader->addOneModuleResponse(MediaWiki\ResourceLoader\DerivativeContext, Wikimedia\Minify\IdentityMinifierState, string, MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule, array)
#7 /srv/mediawiki/php-1.42.0-wmf.21/includes/ResourceLoader/ResourceLoader.php(1115): MediaWiki\ResourceLoader\ResourceLoader->getOneModuleResponse(MediaWiki\ResourceLoader\DerivativeContext, string, MediaWiki\Extension\Gadgets\GadgetResourceLoaderModule)
#8 /srv/mediawiki/php-1.42.0-wmf.21/extensions/WikimediaMaintenance/blameStartupRegistry.php(141): MediaWiki\ResourceLoader\ResourceLoader->makeModuleResponse(MediaWiki\ResourceLoader\DerivativeContext, array)
#9 /srv/mediawiki/php-1.42.0-wmf.21/maintenance/includes/MaintenanceRunner.php(698): BlameStartupRegistry->execute()
#10 /srv/mediawiki/php-1.42.0-wmf.21/maintenance/run.php(51): MediaWiki\Maintenance\MaintenanceRunner->run()
#11 /srv/mediawiki/multiversion/MWScript.php(158): require_once(string)
#12 {main}

Event Timeline

jnuche triaged this task as Unbreak Now! priority.Mar 6 2024, 8:41 AM
jnuche created this task.

Second parameter to titleWithoutPrefix was introduced in rEGADa629d7f71d11: Introduce MultiGadgetRepo to facilitate repo migration but GadgetResourceLoaderModule was not updated. Pinging @Krinkle who merged it. I don't see gadgetName being available in this context, nor am I sure if revert is safe.

Second parameter to titleWithoutPrefix was introduced in rEGADa629d7f71d11: Introduce MultiGadgetRepo to facilitate repo migration but GadgetResourceLoaderModule was not updated. Pinging @Krinkle who merged it. I don't see gadgetName being available in this context, nor am I sure if revert is safe.

Thank you for your comment, I already found out that it's what's wrong, and I've already started making the patch. I'll submit it in a sec.

Change 1009209 had a related patch set uploaded (by Zoranzoki21; author: Zoranzoki21):

[mediawiki/extensions/Gadgets@master] GadgetResourceLoaderModule.php: Add missing $gadgetId argument

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

Change 1009209 abandoned by Zoranzoki21:

[mediawiki/extensions/Gadgets@master] GadgetResourceLoaderModule.php: Add missing $gadgetId argument

Reason:

Nope, my idea isn't going to work.

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

Kizule removed Kizule as the assignee of this task.Mar 6 2024, 9:45 AM
Kizule removed projects: Patch-For-Review, User-Kizule.
Kizule subscribed.

Change 1009211 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Gadgets@master] Add missing type hints to untyped …->getService() calls

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

Change 1009213 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Gadgets@master] Add missing function argument to titleWithoutPrefix call

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

I believe https://gerrit.wikimedia.org/r/1009213 is the most minimal patch possible. Either that or reverting https://gerrit.wikimedia.org/r/981622 as a quick workaround, if that's still possible, and re-applying it later.

Change 1009213 merged by jenkins-bot:

[mediawiki/extensions/Gadgets@master] Add missing function argument to titleWithoutPrefix call

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

Change 1009231 had a related patch set uploaded (by Jaime Nuche; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/Gadgets@wmf/1.42.0-wmf.21] Add missing function argument to titleWithoutPrefix call

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

I've just created a backport patch to unblock 1.42.0-wmf.21. Could someone take a look?

I've just created a backport patch to unblock 1.42.0-wmf.21. Could someone take a look?

I guess it would be the safest option to schedule it for today's "UTC afternoon backport window".

I've just created a backport patch to unblock 1.42.0-wmf.21. Could someone take a look?

I guess it would be the safest option to schedule it for today's "UTC afternoon backport window".

I can most likely backport it before that (train conductor here btw :), but the patch needs first to be approved by someone who knows the code

Change 1009231 merged by jenkins-bot:

[mediawiki/extensions/Gadgets@wmf/1.42.0-wmf.21] Add missing function argument to titleWithoutPrefix call

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

Mentioned in SAL (#wikimedia-operations) [2024-03-06T12:28:23Z] <jnuche@deploy2002> Started scap: Backport for [[gerrit:1009231|Add missing function argument to titleWithoutPrefix call (T359290)]]

Mentioned in SAL (#wikimedia-operations) [2024-03-06T12:30:00Z] <jnuche@deploy2002> jnuche: Backport for [[gerrit:1009231|Add missing function argument to titleWithoutPrefix call (T359290)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-03-06T12:39:34Z] <jnuche@deploy2002> Finished scap: Backport for [[gerrit:1009231|Add missing function argument to titleWithoutPrefix call (T359290)]] (duration: 11m 10s)

jnuche lowered the priority of this task from Unbreak Now! to Needs Triage.Mar 6 2024, 1:35 PM

Change 1009211 merged by jenkins-bot:

[mediawiki/extensions/Gadgets@master] Add missing type hints to untyped …->getService() calls

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

Thanks @thiemowmde and @matmarex for quick fix and review, and Thiemo specifically for the typing improvements to help Phan catch this automatically in CI going forward.

matmarex assigned this task to thiemowmde.