Page MenuHomePhabricator

Log messages at ERROR level on Parser channel: "MediaWiki\OutputTransform\Stages\HandleParsoidSectionLinks::transformDOM: Heading missing for anchor"
Closed, ResolvedPublic

Description

After enabling ERROR logging for all channels on all wikis (T228838), errors like this appeared on the Parser channel:

https://logstash.wikimedia.org/goto/c98272d9a280c69c50acf5e4e38e1652

MediaWiki\OutputTransform\Stages\HandleParsoidSectionLinks::transformDOM: Heading missing for anchor

The volume is low, but I'm filing a task anyway for evaluation, since we were not recording these logs before.

Event Timeline

One example is https://logstash.wikimedia.org/app/discover#/doc/logstash-*/logstash-mediawiki-1-7.0.0-1-2024.10.18?id=t7U5oJIBizfZbaVPAq2Q

These seem to be mostly happens on commons but otherwise where the page name can be interpreted as a file.

A snipit like ==[[#Biografía | Biografía]]== shows what's going on,

> echo "==[[#Biografía | Biografía]]==" | php bin/parse.php --domain commons.wikimedia.org --wrapSections
<section data-mw-section-id="0" data-parsoid="{}"></section><section data-mw-section-id="1" data-parsoid="{}"><h2 id="Biografía" data-parsoid='{"dsr":[0,32,2,2]}'><span id="Biograf.C3.ADa" typeof="mw:FallbackId" data-parsoid='{"dsr":[2,2,null,null]}'></span><a rel="mw:WikiLink" href="./Main_Page#Biografía" class="mw-selflink-fragment" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#Biografía"},"sa":{"href":"#Biografía "},"dsr":[2,30,15,2]}'> Biografía</a></h2>

looks fine, vs

> echo "==[[#Biografía | Biografía]]==" | php bin/parse.php --domain commons.wikimedia.org --wrapSections --pageName "File:Eduardo_Langagne_Ortega.jpg"
<section data-mw-section-id="0" data-parsoid="{}"></section><section data-mw-section-id="1" data-parsoid="{}"><h2 id="" data-parsoid='{"dsr":[0,32,2,2]}'><span class="mw-default-size" typeof="mw:File" data-parsoid='{"optList":[{"ck":"caption","ak":" Biografía"}],"dsr":[2,30,null,null]}' data-mw='{"caption":" Biografía"}'><a href="./File:Eduardo_Langagne_Ortega.jpg" class="mw-file-description" title="Biografía" data-parsoid="{}"><img alt="Biografía" resource="./File:Eduardo_Langagne_Ortega.jpg#Biografía" src="//upload.wikimedia.org/wikipedia/commons/2/2a/Eduardo_Langagne_Ortega.jpg" decoding="async" data-file-width="697" data-file-height="904" data-file-type="bitmap" height="904" width="697" class="mw-file-element" data-parsoid='{"a":{"resource":"./File:Eduardo_Langagne_Ortega.jpg#Biografía","height":"904","width":"697"},"sa":{"resource":"#Biografía "}}'/></a></span></h2>
</section>

That one's clearly a bug in wikilink rendering.

However, another example that is transcluded on a number pages is https://commons.wikimedia.org/wiki/User:Johannes_Maximilian/Autor which uses == == or https://commons.wikimedia.org/wiki/File%3ACoat_of_arms_of_Hungary.svg that has == {{derivative versions}} ==, which is effectively an empty heading as discussed in T368722#9952533

Change #1081459 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/services/parsoid@master] [WIP] Selflink fragment on file page

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

ABreault-WMF triaged this task as Medium priority.
ABreault-WMF moved this task from Backlog to In Progress on the Content-Transform-Team-WIP board.
ABreault-WMF added a subscriber: Arlolra.

Change #1081459 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Render purely fragment links as links on pages in certain namespaces

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

Change #1082836 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.20.0

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

Change #1082836 abandoned by C. Scott Ananian:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.20.0

Reason:

Wrong branch

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

Change #1082837 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@REL1_43] Bump wikimedia/parsoid to 0.20.0

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

Change #1083864 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a2

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

Change #1082837 merged by Arlolra:

[mediawiki/vendor@REL1_43] Bump wikimedia/parsoid to 0.20.0

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

Change #1083864 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a2

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

This still seems to happening at a similar rate.

...

However, another example that is transcluded on a number pages is https://commons.wikimedia.org/wiki/User:Johannes_Maximilian/Autor which uses == == or https://commons.wikimedia.org/wiki/File%3ACoat_of_arms_of_Hungary.svg that has == {{derivative versions}} ==, which is effectively an empty heading as discussed in T368722#9952533

Looking at some recent examples,

https://dag.wikipedia.org/wiki/Kariwana

#

==  ==
<br><gallery class=center caption="Kariwana - Zea mays">

https://en.wikivoyage.org/wiki/Prayagraj

== [[wikipedia:2025_Prayag_Kumbh_Mela|Kumbh Mela 2025]] ==

which parses as a language link, so also empty content.

https://it.wikivoyage.org/wiki/Cermenate

=== <!--* {{eat | nome= | alt= | sito= | email= | indirizzo= | lat= | long= | indicazioni= | tel= | numero verde= | fax= | orari= | prezzo= | descrizione= }}--> ===

https://en.wikivoyage.org/wiki/Sanmenxia

=== <!-- in order of importance, please do not alphabetise --> ===

https://en.wikivoyage.org/w/index.php?title=Bangalore&oldid=98628

====[[Wikipedia:Shivanasamudram|Shivanasamudram]]====

also a language link.

Perhaps the next thing to do is suppress the error log if it's a parsoid assigned id, which is a good indication that we had empty content.

Change #1113209 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/core@master] Suppress error log for empty headings

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

Change #1113209 merged by jenkins-bot:

[mediawiki/core@master] Suppress error log for empty headings

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

Post-deploy, there doesn't appear to have been any of these logs in the past few days,
https://logstash.wikimedia.org/app/discover#/?_g=h@75c69a9&_a=h@d8773cd