Page MenuHomePhabricator

Wikimedia\Parsoid\Utils\TitleException: Invalid characters in title "Template:XXX%3F"
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Parsoid\Utils\TitleException: Invalid characters in title "Template:XXX%3F"
exception.trace
from /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Utils/Title.php(165)
#0 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1007): Wikimedia\Parsoid\Utils\Title::newFromText(string, MediaWiki\Parser\Parsoid\Config\SiteConfig)
#1 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/DOMHandlers/EncapsulatedContentHandler.php(48): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeFromParts(Wikimedia\Parsoid\Html2Wt\SerializerState, Wikimedia\Parsoid\DOM\Element, array)
#2 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1297): Wikimedia\Parsoid\Html2Wt\DOMHandlers\EncapsulatedContentHandler->handle(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\SerializerState, boolean)
#3 [internal function]: Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNodeInternal(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\EncapsulatedContentHandler)
#4 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1393): call_user_func(array, Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\EncapsulatedContentHandler)
#5 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(715): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNode(Wikimedia\Parsoid\DOM\Element)
#6 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/DOMHandlers/PHandler.php(33): Wikimedia\Parsoid\Html2Wt\SerializerState->serializeChildren(Wikimedia\Parsoid\DOM\Element)
#7 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1297): Wikimedia\Parsoid\Html2Wt\DOMHandlers\PHandler->handle(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\SerializerState, boolean)
#8 [internal function]: Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNodeInternal(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\PHandler)
#9 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1393): call_user_func(array, Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\PHandler)
#10 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(715): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNode(Wikimedia\Parsoid\DOM\Element)
#11 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(741): Wikimedia\Parsoid\Html2Wt\SerializerState->serializeChildren(Wikimedia\Parsoid\DOM\Element, NULL)
#12 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1661): Wikimedia\Parsoid\Html2Wt\SerializerState->kickOffSerialize(Wikimedia\Parsoid\DOM\Element)
#13 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Html2Wt/SelectiveSerializer.php(234): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeDOM(Wikimedia\Parsoid\DOM\Element, boolean)
#14 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(234): Wikimedia\Parsoid\Html2Wt\SelectiveSerializer->serializeDOM(Wikimedia\Parsoid\DOM\Document)
#15 /srv/mediawiki/php-1.42.0-wmf.9/vendor/wikimedia/parsoid/src/Parsoid.php(395): Wikimedia\Parsoid\Wikitext\ContentModelHandler->fromDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI, Wikimedia\Parsoid\Core\SelserData)
#16 /srv/mediawiki/php-1.42.0-wmf.9/includes/parser/Parsoid/HtmlToContentTransform.php(615): Wikimedia\Parsoid\Parsoid->dom2wikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, Wikimedia\Parsoid\DOM\Document, array, Wikimedia\Parsoid\Core\SelserData)
#17 /srv/mediawiki/php-1.42.0-wmf.9/includes/parser/Parsoid/HtmlToContentTransform.php(595): MediaWiki\Parser\Parsoid\HtmlToContentTransform->htmlToText()
#18 /srv/mediawiki/php-1.42.0-wmf.9/includes/Rest/Handler/Helper/HtmlInputTransformHelper.php(527): MediaWiki\Parser\Parsoid\HtmlToContentTransform->htmlToContent()
#19 /srv/mediawiki/php-1.42.0-wmf.9/extensions/VisualEditor/includes/DirectParsoidClient.php(233): MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper->getContent()
#20 /srv/mediawiki/php-1.42.0-wmf.9/extensions/VisualEditor/includes/ApiParsoidTrait.php(137): MediaWiki\Extension\VisualEditor\DirectParsoidClient->transformHTML(MediaWiki\Title\Title, Language, string, integer, string)
#21 /srv/mediawiki/php-1.42.0-wmf.9/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(250): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->transformHTML(MediaWiki\Title\Title, string, integer, string)
#22 /srv/mediawiki/php-1.42.0-wmf.9/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(224): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->getWikitextNoCache(MediaWiki\Title\Title, array, array)
#23 /srv/mediawiki/php-1.42.0-wmf.9/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(417): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->getWikitext(MediaWiki\Title\Title, array, array)
#24 /srv/mediawiki/php-1.42.0-wmf.9/includes/api/ApiMain.php(1931): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->execute()
#25 /srv/mediawiki/php-1.42.0-wmf.9/includes/api/ApiMain.php(908): ApiMain->executeAction()
#26 /srv/mediawiki/php-1.42.0-wmf.9/includes/api/ApiMain.php(879): ApiMain->executeActionWithErrorHandling()
#27 /srv/mediawiki/php-1.42.0-wmf.9/api.php(95): ApiMain->execute()
#28 /srv/mediawiki/php-1.42.0-wmf.9/api.php(48): wfApiMain()
#29 /srv/mediawiki/w/api.php(3): require(string)
#30 {main}
Notes
  • Seems to have started with wmf/1.42.0-wmf.9, after rollout to Wikipedias (group2) (so somewhere in gerrit:982166 possibly)
  • API users editing templates
  • Always %3F i.e. ?
  • Happens 135×/day

Event Timeline

I have experienced this error with the template "ba al dakizu?" in Basque Wikipedia when editing with the VisualEditor.

irudia.png (489×637 px, 42 KB)

I have changed the template to "ba al dakizu", without the question mark, and it seems to be working now. So the problem seems to be, indeed, in the question mark.

Xaosflux triaged this task as Medium priority.Jan 12 2024, 2:37 PM
Xaosflux subscribed.

Similar symptoms reported on enwiki here https://en.wikipedia.org/w/index.php?title=Wikipedia%3AVillage_pump_%28technical%29&oldid=1195145759#Unable_to_publish_an_edit_due_to_an_error

Waiting to see if changing wiki text to not include a template redirect with a tailing "?" in the title resolves their issue.

I was not able to cause this problem on the same article using the wikitext editor

Able to consistently duplicate, with VE (have not tried via API)

  1. Go to https://en.wikipedia.org/wiki/User:Xaosflux/sandbox149?veaction=edit
  2. Try to edit the parameters on the second template
  3. Try to publish the page

Note: failure does not occur when using the wikitext editor

Templates with titles ending in "?" do not appear to be extremely common, but do see use especially with new users that are using VE; such as {{Why?}} {{Where?}}, etc

Glancing at where parsoid’s Title would be throwing that error, it looks like it’s a percent-encoded character managing to make it somewhere it shouldn’t, and Title complaining that it's invalid. Presumably somewhere in the path that leads to that point for template titles there's either some double-encoding or some failure-to-decode.

Arlolra moved this task from Needs Triage to Bugs & Crashers on the Parsoid board.
Arlolra moved this task from Backlog to In Progress on the Content-Transform-Team-WIP board.

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

[mediawiki/services/parsoid@master] Decode href before constructing Title

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

Change 990163 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Decode href before attempting to construct a Title

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

Change 990732 had a related patch set uploaded (by Isabelle Hurbain-Palatin; author: Isabelle Hurbain-Palatin):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a13

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

Change 990732 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a13

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

Able to consistently duplicate, with VE (have not tried via API)

  1. Go to https://en.wikipedia.org/wiki/User:Xaosflux/sandbox149?veaction=edit
  2. Try to edit the parameters on the second template
  3. Try to publish the page

Note: failure does not occur when using the wikitext editor

Post-deploy, this no longer appears to be the case.

Also, the errors stopped showing up in the logs after deploying,
https://logstash.wikimedia.org/goto/c8aa790845e54a3778907fdbb248b85e