Page MenuHomePhabricator

ApiUsageException: The "checkuser" module requires a POST request.
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   ApiUsageException: The "checkuser" module requires a POST request.
exception.trace
from /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiUsageException.php(73)
#0 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiBase.php(1534): ApiUsageException::newWithMessage(ApiQuery, array, NULL, NULL, integer)
#1 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiBase.php(1709): ApiBase->dieWithError(array, NULL, NULL, integer)
#2 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiQuery.php(770): ApiBase->dieWithErrorOrDebug(array)
#3 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiQuery.php(999): ApiQuery->instantiateModules(array, string)
#4 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiMain.php(1244): ApiQuery->isWriteMode()
#5 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiMain.php(954): ApiMain->sendCacheHeaders(boolean)
#6 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiMain.php(893): ApiMain->executeActionWithErrorHandling()
#7 /srv/mediawiki/php-1.43.0-wmf.1/includes/api/ApiEntryPoint.php(158): ApiMain->execute()
#8 /srv/mediawiki/php-1.43.0-wmf.1/includes/MediaWikiEntryPoint.php(199): MediaWiki\Api\ApiEntryPoint->execute()
#9 /srv/mediawiki/php-1.43.0-wmf.1/api.php(44): MediaWiki\MediaWikiEntryPoint->run()
#10 /srv/mediawiki/w/api.php(3): require(string)
#11 {main}
Impact
Notes

Details

Request URL
https://www.mediawiki.org/w/api.php?action=query&curequest=*&format=*&list=*

Event Timeline

Do you use any scripts (especially on translatewiki.net)?
Can it be from apihelp?

@Nikerabbit the API module requires that requests use POST. I'm not sure why this is an issue. Unless there is other context I've not seen, I will close this as Invalid as this is the intended behaviour.

It should not be an uncaught exception that appears in logs.

Ah I see.

This is not the fault of CheckUser, but is an issue in core.

FWIW I had tried this with action=login but did not get an exception, so I'm not sure which modules are affected.

FWIW I had tried this with action=login but did not get an exception, so I'm not sure which modules are affected.

Any module that extends ApiQueryBase and that uses a POST request. This is a rare occurrence, so it may just be CheckUser that does this. However, the fix for this is in core.

Change #1023425 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/core@master] Catch exceptions from ::isWriteMode in ApiMain::sendCacheHeaders

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

ApiQuery::isWriteMode is not that old, it is from eabb13833f8237bcd1ea89c8e0834da8d9ccf9f1 / T361951

Yes. This was the cause of this.

Reverting that patch though would cause TransactionProfiler warnings that were incorrectly made (i.e. the module requires post), so I thought that fixing the problem in ApiMain was better than reverting in ApiQuery.

Change #1023425 merged by jenkins-bot:

[mediawiki/core@master] Catch exceptions from ::isWriteMode in ApiMain::sendCacheHeaders

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