Page MenuHomePhabricator

TypeError: Cannot read properties of undefined (reading '0') when using reply tool with transcluded titles in another variant
Closed, ResolvedPublicBUG REPORT

Description

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

What happens?:

Modal window shows:

TypeError: Cannot read properties of undefined (reading '0')

Wikipedia:申请成为管理人员 transcludes its subpage /申請區 (title in zh-hant), which gets automatically resolved by the Language Converter (LC) to the existing page Wikipedia:申请成为管理人员/申请区 (title in zh-hans). Note that the page with the exact title /申請區 does not exist. On zhwiki, sometimes a redirection page to the other variant is created ("繁简重定向"), however it's not always done, as the LC can handle that.

The action=discussiontoolspageinfo API response shows Wikipedia:申请成为管理人员/申請區 in the transcludedfrom object. Subsequent action=query&prop=revisions on this title fails because the title does not exist (the converttitles API parameter will invoke the LC to resolve the canonical title, which is helpful sometimes). I would not be surprised if Parsoid's incomplete support for LC is one of the reasons here.

Reply tool works correctly on the subpage /申请区, where the discussiontools-error-comment-is-transcluded message is shown. That's because the discussion is eventually transcluded from Wikipedia:申请成为管理员/Bosco Sin. That page is under full protection due to some local affairs, and reply tool gives the protectedpagetext message there.

(original report on zhwiki)

What should have happened instead?:

Wikipedia:申请成为管理人员 should give normal error message, instead of a caught exception message.

Software version: 1.45.0-wmf.24

Event Timeline

Bewfip renamed this task from TypeError: Cannot read properties of undefined (reading '0') when using reply tool on discussion transcluded from protected page to TypeError: Cannot read properties of undefined (reading '0') when using reply tool with transcluded titles in another variant.Oct 26 2025, 9:07 PM
Bewfip added a project: Chinese-Sites.
Bewfip updated the task description. (Show Details)
Bewfip moved this task from Backlog to Extensions/Skins on the Chinese-Sites board.

Your page seems to have changed. But I can reproduce the issue by creating the pages locally with zh as content language.

Change #1222590 had a related patch set uploaded (by Ammarpad; author: Ammarpad):

[mediawiki/extensions/DiscussionTools@master] CommentController: Convert title variants when possible

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

Your page seems to have changed.

Indeed, I should have crafted a more stable reproduction after identifying the condition. Thank you for debugging and creating the patch.

Test wiki created on Patch demo by Ammarpad using patch(es) linked to this task:
https://d159c23908.catalyst.wmcloud.org/w/

Change #1222590 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] CommentController: Improve handling for variant-title transclusion

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

matmarex assigned this task to Ammarpad.
matmarex subscribed.

The change will be deployed to Wikimedia wikis this week on the usual schedule. Thanks for the patch, @Ammarpad!

I tried making a reply on the page mentioned in the original report, and it works correctly. Thanks to Ammarpad and matmarex for the fix!


Oops, I should have searched here before making this report. I thought this is a new issue when discovering the discussion on the wiki.