Page MenuHomePhabricator

ArticleGuidance: TypeError: str_contains(): Argument #1 ($haystack) must be of type string, null given
Closed, ResolvedPublic1 Estimated Story PointsPRODUCTION ERROR

Description

Error
  • service.version: 1.47.0-wmf.1
  • timestamp: 2026-05-07T20:33:40.616Z
  • labels.phpversion: 8.3.30
  • trace.id: 6e2a7f41-6911-4752-9434-0b5033030afd
  • Find trace.id in Logstash
labels.normalized_message
[{reqId}] {exception_url}   TypeError: str_contains(): Argument #1 ($haystack) must be of type string, null given
FrameLocationCall
from/srv/mediawiki/php-1.47.0-wmf.1/extensions/ArticleGuidance/src/Hooks/PreloadCleanupHandler.php(18)
#0/srv/mediawiki/php-1.47.0-wmf.1/extensions/ArticleGuidance/src/Hooks/PreloadCleanupHandler.php(18)str_contains(null, string)
#1/srv/mediawiki/php-1.47.0-wmf.1/includes/HookContainer/HookContainer.php(127)MediaWiki\Extension\ArticleGuidance\Hooks\PreloadCleanupHandler->onEditFormPreloadText(null, MediaWiki\Title\Title)
#2/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiHookRunner.php(359)MediaWiki\HookContainer\HookContainer->run(string, array)
#3/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQueryInfo.php(447)MediaWiki\Api\ApiHookRunner->onEditFormPreloadText(null, MediaWiki\Title\Title)
#4/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQueryInfo.php(304)MediaWiki\Api\ApiQueryInfo->extractPageInfo(int, MediaWiki\Title\Title)
#5/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiQuery.php(735)MediaWiki\Api\ApiQueryInfo->execute()
#6/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(2045)MediaWiki\Api\ApiQuery->execute()
#7/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(949)MediaWiki\Api\ApiMain->executeAction()
#8/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiMain.php(920)MediaWiki\Api\ApiMain->executeActionWithErrorHandling()
#9/srv/mediawiki/php-1.47.0-wmf.1/includes/Api/ApiEntryPoint.php(138)MediaWiki\Api\ApiMain->execute()
#10/srv/mediawiki/php-1.47.0-wmf.1/includes/MediaWikiEntryPoint.php(180)MediaWiki\Api\ApiEntryPoint->execute()
#11/srv/mediawiki/php-1.47.0-wmf.1/api.php(30)MediaWiki\MediaWikiEntryPoint->run()
#12/srv/mediawiki/w/api.php(3)require(string)
#13{main}
Notes

Saw burst of 381 of of these for simplewiki, in the recently-deployed 1.47.0-wmf.1 (T423910).

Event Timeline

Introduced by https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ArticleGuidance/+/1280505.

Interestingly, onEditFormPreloadText is documented to take a non-null $text parameter, but ApiQueryInfo passes null to it. According to git blame, this has been the case for a long time. It seems like core is wrong here.

Change #1284946 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/core@master] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1284946 merged by jenkins-bot:

[mediawiki/core@master] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285408 had a related patch set uploaded (by Reedy; author: SomeRandomDeveloper):

[mediawiki/core@REL1_46] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285409 had a related patch set uploaded (by Reedy; author: SomeRandomDeveloper):

[mediawiki/core@REL1_45] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285410 had a related patch set uploaded (by Reedy; author: SomeRandomDeveloper):

[mediawiki/core@REL1_44] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285411 had a related patch set uploaded (by Reedy; author: SomeRandomDeveloper):

[mediawiki/core@REL1_43] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285410 merged by jenkins-bot:

[mediawiki/core@REL1_44] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285411 merged by jenkins-bot:

[mediawiki/core@REL1_43] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285408 merged by jenkins-bot:

[mediawiki/core@REL1_46] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Change #1285409 merged by jenkins-bot:

[mediawiki/core@REL1_45] ApiQueryInfo: Pass an empty string instead of null to EditFormPreloadText hook

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

Do we want to backport this (I could schedule it for the UTC late backport window today), or is the error rate low enough that it's not necessary and we can wait until it rolls out through the train?

The fix should've been deployed through the train last week, are there still any errors?

Nikerabbit moved this task from Backlog to Product Signoff on the LPL Hypothesis board.
Nikerabbit set the point value for this task to 1.
Nikerabbit subscribed.

Not seen after 1.47.0-wmf.1 Thanks for fixing!