Page MenuHomePhabricator

TypeError: Argument passed to Translate\JsonFormat::isContentEqual() must be of the type string or null, bool given
Closed, ResolvedPublic4 Estimated Story PointsPRODUCTION ERROR

Description

Error
message
[no req]   TypeError: Argument 2 passed to MediaWiki\Extension\Translate\FileFormatSupport\JsonFormat::isContentEqual() must be of the type string or null, bool given
trace
[2024-01-30T06:58:24.324167+00:00] exception.ERROR: [d7c34ac6433e84c42c32a3fb] [no req]   TypeError: Argument 2 passed to MediaWiki\Extension\Translate\FileFormatSupport\JsonFormat::isContentEqual() must be of the type string or null, bool given, called in /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ExternalMessageSourceStateComparator.php on line 175 {"exception":"[object] (TypeError(code: 0): Argument 2 passed to MediaWiki\\Extension\\Translate\\FileFormatSupport\\JsonFormat::isContentEqual() must be of the type string or null, bool given, called in /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ExternalMessageSourceStateComparator.php on line 175 at /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/FileFormatSupport/JsonFormat.php:128)
[stacktrace]
#0 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ExternalMessageSourceStateComparator.php(175): MediaWiki\\Extension\\Translate\\FileFormatSupport\\JsonFormat->isContentEqual()
#1 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ExternalMessageSourceStateComparator.php(72): MediaWiki\\Extension\\Translate\\Synchronization\\ExternalMessageSourceStateComparator->addMessageUpdateChanges()
#2 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ExternalMessageSourceStateComparator.php(58): MediaWiki\\Extension\\Translate\\Synchronization\\ExternalMessageSourceStateComparator->processLanguage()
#3 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/src/Synchronization/ImportExternalTranslationsMaintenanceScript.php(104): MediaWiki\\Extension\\Translate\\Synchronization\\ExternalMessageSourceStateComparator->processGroup()
#4 /srv/mediawiki/tags/2024-01-24_15:32:48/maintenance/includes/MaintenanceRunner.php(698): MediaWiki\\Extension\\Translate\\Synchronization\\ImportExternalTranslationsMaintenanceScript->execute()
#5 /srv/mediawiki/tags/2024-01-24_15:32:48/maintenance/doMaintenance.php(100): MediaWiki\\Maintenance\\MaintenanceRunner->run()
#6 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/scripts/__bootstrap.php(19): require_once('/srv/mediawiki/...')
#7 /srv/mediawiki/tags/2024-01-24_15:32:48/extensions/Translate/scripts/importExternalTranslations.php(6): require_once('/srv/mediawiki/...')
#8 {main}
Impact

Potentially impacting translation imports from projects

Notes

Maybe caused as a result of refactoring done in 989441: Move ExternalMessageSourceStateComparator to Synchronisation namespace. for T340724: Modernize code under util/ directory

Event Timeline

abi_ triaged this task as High priority.Jan 31 2024, 5:06 AM
abi_ created this task.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
abi_ renamed this task from ypeError: Argument passed to Translate\JsonFormat::isContentEqual() must be of the type string or null, bool given to TypeError: Argument passed to Translate\JsonFormat::isContentEqual() must be of the type string or null, bool given.Jan 31 2024, 5:06 AM

Import of new translations is impossible now, therefore export is broken too.

Change 997780 had a related patch set uploaded (by Tacsipacsi; author: Tacsipacsi):

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: avoid TypeError on cache miss

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

I've deployed a hotfix based on @Tacsipacsi patch but with added logging.

Initial info seems to lead to the conclusion that this happens when the following steps happen in this order:

  • Initial translation is created
  • Translation is exported
  • Translation is updated
  • Translations are synchronized

In this condition: wiki content is different from external content, but there isn't yet a cache entry.

It is not clear how to deal with this entry:

  • If we don't ignore the change, we will see wrong diffs and suggestion to revert to the previous version
  • If we ignore the change, things are okay, but can we accidentally miss legitimate changes from other conditions?

What if Special:ManageMessageGroups displayed a warning? It’d complicate things quite a bit due to the half-maintenance script, half-special page setup, though.

One thing that I often manually check is the last diff on the wiki. I think it would be helpful to have a link on the UI to link to the last diff directly. Going one step further, the UI could indicate if the incoming change is a reversal of the last edit on the wiki.

Nikerabbit changed the point value for this task from 2 to 4.
Nikerabbit added a subscriber: Tacsipacsi.

Change #1023429 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] Add ExternalMessageSourceStateComparator service

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

Change #997780 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: avoid TypeError on cache miss

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

Change #1023429 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Add ExternalMessageSourceStateComparator service

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

Change #1026702 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: Log on unexpected cache miss

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

Change #1026702 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: Log on unexpected cache miss

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

With the latest patches deployed:

$ cat /www/translatewiki.net/logs/debug | grep 'Expected cache miss'

Returns no hits

$ cat /www/translatewiki.net/logs/debug | grep 'Unexpected'
[2024-05-04T22:30:23.097484+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-ios-image-rec-tooltip-3-body in language: pt-br. Cache update time: 20240502143026 {"messageKey":"wikipedia-ios-image-rec-tooltip-3-body","language":"pt-br","cacheUpdateTime":"20240502143026"} []
[2024-05-05T00:30:31.008458+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-ios-image-rec-tooltip-3-body in language: pt-br. Cache update time: 20240502143026 {"messageKey":"wikipedia-ios-image-rec-tooltip-3-body","language":"pt-br","cacheUpdateTime":"20240502143026"} []
[2024-05-05T02:30:29.607091+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-ios-image-rec-tooltip-3-body in language: pt-br. Cache update time: 20240502143026 {"messageKey":"wikipedia-ios-image-rec-tooltip-3-body","language":"pt-br","cacheUpdateTime":"20240502143026"} []
[2024-05-05T04:30:23.097868+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-ios-image-rec-tooltip-3-body in language: pt-br. Cache update time: 20240502143026 {"messageKey":"wikipedia-ios-image-rec-tooltip-3-body","language":"pt-br","cacheUpdateTime":"20240502143026"} []
[2024-05-05T06:30:29.986733+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-ios-image-rec-tooltip-3-body in language: pt-br. Cache update time: 20240502143026 {"messageKey":"wikipedia-ios-image-rec-tooltip-3-body","language":"pt-br","cacheUpdateTime":"20240502143026"} []
[2024-05-06T11:52:36.258806+00:00] Translate.WARNING: Unexpected cache miss for nearby-pages-desc in language: eu. Cache update time: 20230131125213 {"messageKey":"nearby-pages-desc","language":"eu","cacheUpdateTime":"20230131125213"} []
[2024-05-06T11:52:36.262811+00:00] Translate.WARNING: Unexpected cache miss for nearby-pages-error in language: eu. Cache update time: 20230131125213 {"messageKey":"nearby-pages-error","language":"eu","cacheUpdateTime":"20230131125213"} []
[2024-05-06T11:52:36.283814+00:00] Translate.WARNING: Unexpected cache miss for nearby-pages-requirements in language: eu. Cache update time: 20230131125213 {"messageKey":"nearby-pages-requirements","language":"eu","cacheUpdateTime":"20230131125213"} []
[2024-05-06T11:52:36.286903+00:00] Translate.WARNING: Unexpected cache miss for nearby-pages-title in language: eu. Cache update time: 20230131125213 {"messageKey":"nearby-pages-title","language":"eu","cacheUpdateTime":"20230131125213"} []
[2024-05-06T18:30:26.823674+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-06T20:30:23.865415+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-06T22:30:23.196316+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-07T00:30:23.298827+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-07T02:30:27.820887+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-07T04:30:23.447722+00:00] Translate.WARNING: Unexpected cache miss for wikipedia-android-strings-donate_gpay_check_transaction_fee in language: da. Cache update time: 20240423143027 {"messageKey":"wikipedia-android-strings-donate_gpay_check_transaction_fee","language":"da","cacheUpdateTime":"20240423143027"} []
[2024-05-07T11:51:34.960694+00:00] Translate.WARNING: Unexpected cache miss for growthexperiments-homepage-impact-scores-best-streak-info-data-text-third-person in language: it. Cache update time: 20240401115140 {"messageKey":"growthexperiments-homepage-impact-scores-best-streak-info-data-text-third-person","language":"it","cacheUpdateTime":"20240401115140"} []
[2024-05-07T11:51:35.293459+00:00] Translate.WARNING: Unexpected cache miss for growthexperiments-mentor-dashboard-personalized-praise-info-headline in language: it. Cache update time: 20240404115120 {"messageKey":"growthexperiments-mentor-dashboard-personalized-praise-info-headline","language":"it","cacheUpdateTime":"20240404115120"} []
[2024-05-07T11:51:35.645614+00:00] Translate.WARNING: Unexpected cache miss for communityconfiguration-growthsuggestededits-references-disabled-control-label in language: it. Cache update time: 20240503115122 {"messageKey":"communityconfiguration-growthsuggestededits-references-disabled-control-label","language":"it","cacheUpdateTime":"20240503115122"} []
[2024-05-07T11:51:35.648997+00:00] Translate.WARNING: Unexpected cache miss for communityconfiguration-growthsuggestededits-update-disabled-control-label in language: it. Cache update time: 20240503115122 {"messageKey":"communityconfiguration-growthsuggestededits-update-disabled-control-label","language":"it","cacheUpdateTime":"20240503115122"} []
[2024-05-07T11:51:35.652936+00:00] Translate.WARNING: Unexpected cache miss for communityconfiguration-growthsuggestededits-link_recommendation-disabled-control-label in language: it. Cache update time: 20240503115122 {"messageKey":"communityconfiguration-growthsuggestededits-link_recommendation-disabled-control-label","language":"it","cacheUpdateTime":"20240503115122"} []
[2024-05-08T11:53:07.863087+00:00] Translate.WARNING: Unexpected cache miss for wm-license-cc-by-sa-4.0-3.0-2.5-2.0-1.0-text in language: es. Cache update time: 20240403100853 {"messageKey":"wm-license-cc-by-sa-4.0-3.0-2.5-2.0-1.0-text","language":"es","cacheUpdateTime":"20240403100853"} []

Change #1029229 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: Add more logs on cache miss

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

Change #1029229 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ExternalMessageSourceStateComparator: Add more logs on cache miss

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

Last two unexpected cache misses:

[2024-05-13T11:53:38.496362+00:00] Translate.WARNING: Unexpected cache miss for edit-recovery-special-user-unnamed in language: cs. Cache update time: 20240507115316 {"messageKey":"edit-recovery-special-user-unnamed","language":"cs","cacheUpdateTime":"20240507115316"} []
[2024-05-13T11:53:38.499890+00:00] Translate.WARNING: Unexpected cache miss for edit-recovery-special-user-not-enabled in language: cs. Cache update time: 20240507115316 {"messageKey":"edit-recovery-special-user-not-enabled","language":"cs","cacheUpdateTime":"20240507115316"} []

There haven't been any occurrences since our patch that adds more information was deployed.

Since the last check on 17th May, 2024, there have been a few occurrences of expected and unexpected cache misses:

Expected cache misses

[2024-05-21T12:52:57.409069+00:00] Translate.INFO: Expected cache miss for wm-license-gfdl-1.2-and-later in language: ccp. Cache update time: 20240520125323 {"messageKey":"wm-license-gfdl-1.2-and-later","language":"ccp","cacheUpdateTime":"20240520125323","oldestRevisionTs":"20240520093922","latestRevisionTs":"20240521091539"} []
[2024-05-21T12:53:13.948041+00:00] Translate.INFO: Expected cache miss for anontalkpagetext in language: ccp. Cache update time: 20240520131640 {"messageKey":"anontalkpagetext","language":"ccp","cacheUpdateTime":"20240520131640","oldestRevisionTs":"20240520111052","latestRevisionTs":"20240521100757"} []
[2024-05-21T12:53:13.951957+00:00] Translate.INFO: Expected cache miss for previewnote in language: ccp. Cache update time: 20240520131640 {"messageKey":"previewnote","language":"ccp","cacheUpdateTime":"20240520131640","oldestRevisionTs":"20240520104832","latestRevisionTs":"20240521095217"} []
[2024-05-21T12:53:13.955665+00:00] Translate.INFO: Expected cache miss for recreate-moveddeleted-warn in language: ccp. Cache update time: 20240520131640 {"messageKey":"recreate-moveddeleted-warn","language":"ccp","cacheUpdateTime":"20240520131640","oldestRevisionTs":"20240520095838","latestRevisionTs":"20240521095008"} []
[2024-05-21T12:53:13.960285+00:00] Translate.INFO: Expected cache miss for wlnote in language: ccp. Cache update time: 20240520131640 {"messageKey":"wlnote","language":"ccp","cacheUpdateTime":"20240520131640","oldestRevisionTs":"20240520111352","latestRevisionTs":"20240521101158"} []
[2024-05-21T12:53:13.964439+00:00] Translate.INFO: Expected cache miss for blockedtext-contact-blocker-admin in language: ccp. Cache update time: 20240520131640 {"messageKey":"blockedtext-contact-blocker-admin","language":"ccp","cacheUpdateTime":"20240520131640","oldestRevisionTs":"20240520105101","latestRevisionTs":"20240521095726"} []

Unexpected cache misses

[2024-05-20T12:51:35.722274+00:00] Translate.WARNING: Unexpected cache miss for fanbox-userdoesnotexist in language: de. Cache update time: 20230426115036 {"messageKey":"fanbox-userdoesnotexist","language":"de","cacheUpdateTime":"20230426115036","oldestRevisionTs":"20240519181250","latestRevisionTs":"20240520083431"} []
[2024-05-20T12:51:35.726499+00:00] Translate.WARNING: Unexpected cache miss for fanbox-list-title in language: de. Cache update time: 20230426115036 {"messageKey":"fanbox-list-title","language":"de","cacheUpdateTime":"20230426115036","oldestRevisionTs":"20240519181321","latestRevisionTs":"20240520083326"} []
[2024-05-20T12:51:35.730330+00:00] Translate.WARNING: Unexpected cache miss for fanbox-top-list-is-empty in language: de. Cache update time: 20230426115036 {"messageKey":"fanbox-top-list-is-empty","language":"de","cacheUpdateTime":"20230426115036","oldestRevisionTs":"20240519181525","latestRevisionTs":"20240520083254"} []

The above appears to be a case of the cache not being updated in a very long time (since 2023-04-26 11:50:36), I'm not sure why this would be the case.

Marking this task as done as we've handled the specific case that was identified here. I've create a separate task to investigate the unexpected cache misses: T365602: Identify cases of unexpected message group cache misses when processing imports