Page MenuHomePhabricator

CX Language selector entrypoint: TypeError: cxLanguageMatches is null
Closed, ResolvedPublicPRODUCTION ERROR

Description

Steps to replicate the issue (include links if applicable):

What happens?:
Error in the console.

listMatchedLanguageAutonyms ext.cx.entrypoints.languagesearcher.js:194
    onLanguageMatch ext.cx.entrypoints.languagesearcher.js:236
    showTranslationCTA ext.cx.entrypoints.languagesearcher.js:301
    promise callback*showTranslationCTA ext.cx.entrypoints.languagesearcher.js:297
    add mediawiki.base.js:534
    js ext.cx.entrypoints.languagesearcher.js:306
    js ext.cx.entrypoints.languagesearcher.js:308
    runScript startup.js:1283
    cssHandle startup.js:1351
    flushCssBuffer startup.js:597
    addEmbeddedCSS startup.js:628
    execute startup.js:1365
    doPropagation startup.js:748
    requestIdleCallback handler*setAndPropagate startup.js:821
    impl startup.js:2010
    <anonymous> load.php:1

What should have happened instead?:
No error should be displayed on the console.

Other information (browser name/version, screenshots, etc.):

image.png (1×1 px, 214 KB)

Derived Requirement

Ensure that selecting any language (e.g., "Igbo") in the Content Translation language selector entrypoint does not result in a TypeError: cxLanguageMatches is null. The application must handle null or undefined values gracefully and prevent JavaScript errors from being logged in the browser console.

  • The cxLanguageMatches variable must be properly checked for null before accessing its properties.
  • Language selection should never crash the UI or throw console errors, regardless of the input.
Test Steps

Test Case 1: Ensure Language Selection Does Not Trigger Console Error

  1. Go to https://en.m.wikipedia.org/wiki/Flotilla_(video_game)#.
  2. Open the developer tools in the browser (Console tab).
  3. Open the language selector (translation entry point).
  4. Type Igbo in the selector's search input.
  5. ✅❓❌⬜ AC1: Confirm that no TypeError: cxLanguageMatches is null or similar JavaScript error is logged in the browser console.

QA Results - Test Wiki

ACStatusDetails
1T389920#10722795

Event Timeline

abi_ triaged this task as High priority.Mar 25 2025, 8:26 AM
abi_ changed the subtype of this task from "Bug Report" to "Production Error".

Appears to be caused due to: 1130169: Enable Section Translation and Unified Dashboard on all wikipedias | https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/1130169 where wgSectionTranslationTargetLanguages were removed and the value became null.

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

[mediawiki/extensions/ContentTranslation@master] ext.cx.entrypoints: Handle null for SectionTranslationTargetLanguages

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

Change #1130951 abandoned by Abijeet Patro:

[mediawiki/extensions/ContentTranslation@master] ext.cx.entrypoints: Handle null for SectionTranslationTargetLanguages

Reason:

In favor of I971ebebb04bcc8525832d78a47e4bf5af0b289fb

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

Mentioned in SAL (#wikimedia-operations) [2025-03-26T08:55:41Z] <kart_> Deployed: Add all language codes to SectionTranslationTargetLanguages (T389920)

I believe the config change (adding back all the target languages) and deployment we did last week should have fixed this error. Moving to QA

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated the task description. (Show Details)

@abi_ @SBisson Confirmed that no TypeError: cxLanguageMatches is null or similar JavaScript error is logged in the browser console as seen in the gif below. Just a heads up that you do get a warning as seen below, when anytime you get Language not available. I will move this to sign-off, thanks!

Test Result - PROD

Status: ✅ PASS
Environment: PROD
OS: macOS Sequoia 15.4
Browser: Chrome 134
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://en.m.wikipedia.org/wiki/Flotilla_(video_game)#

Test Steps

Test Case 1: Ensure Language Selection Does Not Trigger Console Error

  1. Go to https://en.m.wikipedia.org/wiki/Flotilla_(video_game)#.
  2. Open the developer tools in the browser (Console tab).
  3. Open the language selector (translation entry point).
  4. Type Igbo in the selector's search input.
  5. AC1: Confirm that no TypeError: cxLanguageMatches is null or similar JavaScript error is logged in the browser console.
IGBO
2025-04-08_08-29-18.mp4.gif (1×1 px, 546 KB)

Not related to the task and it's just a warning but it appears when the Language is not available.

jquery.js:3783 jQuery.Deferred exception: Cannot read properties of undefined (reading 'ButtonWidget') TypeError: Cannot read properties of undefined (reading 'ButtonWidget')
    at onLanguageMatch (https://en.m.wikipedia.org/w/load.php?lang=en&modules=ext.cx.entrypoints.languagesearcher.legacy&skin=minerva&version=1b23t:2:452)
    at https://en.m.wikipedia.org/w/load.php?lang=en&modules=ext.cx.entrypoints.languagesearcher.legacy&skin=minerva&version=1b23t:4:67
    at mightThrow (https://en.m.wikipedia.org/w/load.php?lang=en&modules=jquery&skin=minerva&version=r2z40:44:983)
    at process (https://en.m.wikipedia.org/w/load.php?lang=en&modules=jquery&skin=minerva&version=r2z40:45:643) undefined
GMikesell-WMF removed GMikesell-WMF as the assignee of this task.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF subscribed.