Currently, there are a couple of pages (Item, Lexeme) on test Wikidata which errors when we try to index it for a search. The frequency of this error over the last week was 6 times for 7 days which leads to some amount of logspam.
Acceptance Criteria:
- The error no longer occurs (seems to be caused by the data type changes mentioned in the comments below. See method: Wikibase\Search\Elastic\Fields\StatementsField::getSnakAsPropertyIdAndValue)
- After deployment, we’ve also looked at the suspected duplicate T380376 and either closed it as well (if it was fixed by the same changes) or moved it out of Stalled status (if it’s something different after all).
Notes:
The error can be reproduce locally by:
- creating a property with data type “Point in time”
- creating a statement with that property and a time value
- commenting out the assertDataTypesCompatible() check in PropertyDataTypeChanger::changeDataType()
- using the repo/maintenance/changePropertyDataType.php maintenance script to change the data type of the property from “Point in time” to “String” (--new-data-type=string)
- making sure WikibaseCirrusSearch is loaded, $wgSearchType is 'CirrusSearch', $wgWBCSUseCirrus is true, and $wgWBRepoSettings['searchIndexTypes'] includes 'string'
- getting WikibaseCirrusSearch to re-index the entity with the now-broken statement, using an API call similar to the one in T372993#10104381
- you might have to clear your MediaWiki cache first (e.g. restart memcached or truncate the objectcache database table)
Original Title / Error Message:
TypeError: Argument 1 passed to Wikimedia\Services\ServiceContainer::{closure}() must be an instance of DataValues\StringValue, instance of DataValues\TimeValue given, called in extensions/WikibaseCirrusSearch/src/Fields/StatementsField.php:177
Original Report:
Error
- service.version: 1.43.0-wmf.19
- trace.id: e73b5ac6-5747-4567-a57c-68172fe4cb0f
- Find trace.id in Logstash
[{reqId}] {exception_url} TypeError: Argument 1 passed to Wikimedia\Services\ServiceContainer::{closure}() must be an instance of DataValues\StringValue, instance of DataValues\TimeValue given, called in /srv/mediawiki/php-1.43.0-wmf.19/extensions/Wikibfrom /srv/mediawiki/php-1.43.0-wmf.19/extensions/Wikibase/repo/WikibaseRepo.datatypes.php(297)
#0 /srv/mediawiki/php-1.43.0-wmf.19/extensions/WikibaseCirrusSearch/src/Fields/StatementsField.php(177): Wikimedia\Services\ServiceContainer->{closure}(DataValues\TimeValue)
#1 /srv/mediawiki/php-1.43.0-wmf.19/extensions/WikibaseCirrusSearch/src/Fields/StatementsField.php(196): Wikibase\Search\Elastic\Fields\StatementsField->getSnakAsPropertyIdAndValue(Wikibase\DataModel\Snak\PropertyValueSnak, string)
#2 /srv/mediawiki/php-1.43.0-wmf.19/extensions/WikibaseCirrusSearch/src/Fields/StatementsField.php(132): Wikibase\Search\Elastic\Fields\StatementsField->getSnakAsString(Wikibase\DataModel\Snak\PropertyValueSnak)
#3 /srv/mediawiki/php-1.43.0-wmf.19/extensions/Wikibase/repo/includes/Content/EntityHandler.php(715): Wikibase\Search\Elastic\Fields\StatementsField->getFieldData(Wikibase\DataModel\Entity\Item)
#4 /srv/mediawiki/php-1.43.0-wmf.19/extensions/Wikibase/repo/includes/Content/EntityHandler.php(696): Wikibase\Repo\Content\EntityHandler->getContentDataForSearchIndex(Wikibase\Repo\Content\ItemContent)
#5 /srv/mediawiki/php-1.43.0-wmf.19/extensions/CirrusSearch/includes/BuildDocument/ParserOutputPageProperties.php(106): Wikibase\Repo\Content\EntityHandler->getDataForSearchIndex(WikiPage, MediaWiki\Parser\ParserOutput, CirrusSearch\CirrusSearch, MediaWiki\Revision\RevisionStoreRecord)
#6 /srv/mediawiki/php-1.43.0-wmf.19/includes/libs/objectcache/wancache/WANObjectCache.php(1729): CirrusSearch\BuildDocument\ParserOutputPageProperties->CirrusSearch\BuildDocument\{closure}(bool, int, array, null, array)
#7 /srv/mediawiki/php-1.43.0-wmf.19/includes/libs/objectcache/wancache/WANObjectCache.php(1559): WANObjectCache->fetchOrRegenerate(string, int, Closure, array, array)
#8 /srv/mediawiki/php-1.43.0-wmf.19/extensions/CirrusSearch/includes/BuildDocument/ParserOutputPageProperties.php(109): WANObjectCache->getWithSetCallback(string, int, Closure)
#9 /srv/mediawiki/php-1.43.0-wmf.19/extensions/CirrusSearch/includes/BuildDocument/ParserOutputPageProperties.php(51): CirrusSearch\BuildDocument\ParserOutputPageProperties->finalizeReal(Elastica\Document, WikiPage, CirrusSearch\CirrusSearch, MediaWiki\Revision\RevisionStoreRecord)
#10 /srv/mediawiki/php-1.43.0-wmf.19/extensions/CirrusSearch/includes/BuildDocument/BuildDocument.php(196): CirrusSearch\BuildDocument\ParserOutputPageProperties->finalize(Elastica\Document, MediaWiki\Title\Title, MediaWiki\Revision\RevisionStoreRecord)
#11 /srv/mediawiki/php-1.43.0-wmf.19/extensions/CirrusSearch/includes/Api/QueryBuildDocument.php(112): CirrusSearch\BuildDocument\BuildDocument->finalize(Elastica\Document, bool, MediaWiki\Revision\RevisionStoreRecord)
#12 /srv/mediawiki/php-1.43.0-wmf.19/includes/api/ApiQuery.php(711): CirrusSearch\Api\QueryBuildDocument->execute()
#13 /srv/mediawiki/php-1.43.0-wmf.19/includes/api/ApiMain.php(1948): ApiQuery->execute()
#14 /srv/mediawiki/php-1.43.0-wmf.19/includes/api/ApiMain.php(926): ApiMain->executeAction()
#15 /srv/mediawiki/php-1.43.0-wmf.19/includes/api/ApiMain.php(897): ApiMain->executeActionWithErrorHandling()
#16 /srv/mediawiki/php-1.43.0-wmf.19/includes/api/ApiEntryPoint.php(153): ApiMain->execute()
#17 /srv/mediawiki/php-1.43.0-wmf.19/includes/MediaWikiEntryPoint.php(200): MediaWiki\Api\ApiEntryPoint->execute()
#18 /srv/mediawiki/php-1.43.0-wmf.19/api.php(44): MediaWiki\MediaWikiEntryPoint->run()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}Impact
Low: Nine occurrences since first occurrence on 2024-08-01 (1.43.0-wmf.16)

