Page MenuHomePhabricator

Wikimedia\Assert\InvariantException: Invariant failed: Bad UTF-8 at end of string (3 byte sequence)
Open, LowPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\InvariantException: Invariant failed: Bad UTF-8 at end of string (3 byte sequence)
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/assert/src/Assert.php(231)
#0 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Utils/PHPUtils.php(204): Wikimedia\Assert\Assert::invariant(boolean, string)
#1 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Tokens/SourceRange.php(82): Wikimedia\Parsoid\Utils\PHPUtils::safeSubstr(string, integer, integer)
#2 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateEncapsulator.php(139): Wikimedia\Parsoid\Tokens\SourceRange->substr(string)
#3 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateEncapsulator.php(73): Wikimedia\Parsoid\Wt2Html\TT\TemplateEncapsulator->getTemplateInfo()
#4 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(780): Wikimedia\Parsoid\Wt2Html\TT\TemplateEncapsulator->encapTokens(array)
#5 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1081): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->encapTokens(Wikimedia\Parsoid\Wt2Html\TT\TemplateEncapsulator, array)
#6 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TemplateHandler.php(1123): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTemplate(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#7 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(150): Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#8 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(132): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#9 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(185): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#10 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(140): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->process(array, array)
#11 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Utils/PipelineUtils.php(106): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parse(string, array)
#12 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Ext/ParsoidExtensionAPI.php(397): Wikimedia\Parsoid\Utils\PipelineUtils::processContentInPipeline(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\Wt2Html\PageConfigFrame, string, array)
#13 /srv/mediawiki/php-1.41.0-wmf.25/extensions/Kartographer/includes/Tag/ParsoidMapFrame.php(98): Wikimedia\Parsoid\Ext\ParsoidExtensionAPI->wikitextToDOM(string, array, boolean)
#14 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(97): Kartographer\Tag\ParsoidMapFrame->sourceToDom(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI, string, array)
#15 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/ExtensionHandler.php(277): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onExtension(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#16 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TT/TokenHandler.php(150): Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler->onTag(Wikimedia\Parsoid\Tokens\SelfclosingTagTk)
#17 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(132): Wikimedia\Parsoid\Wt2Html\TT\TokenHandler->process(array)
#18 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(195): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunk(array)
#19 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TokenTransformManager.php(193): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#20 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/TreeBuilder/TreeBuilderStage.php(489): Wikimedia\Parsoid\Wt2Html\TokenTransformManager->processChunkily(string, array)
#21 [internal function]: Wikimedia\Parsoid\Wt2Html\TreeBuilder\TreeBuilderStage->processChunkily(string, array)
#22 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(971): Generator->current()
#23 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#24 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#25 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(164): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#26 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Parsoid.php(195): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#27 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/src/Parsoid.php(233): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#28 /srv/mediawiki/php-1.41.0-wmf.25/includes/parser/Parsoid/ParsoidOutputAccess.php(302): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#29 /srv/mediawiki/php-1.41.0-wmf.25/includes/parser/Parsoid/ParsoidOutputAccess.php(480): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->parseInternal(MediaWiki\Parser\Parsoid\Config\PageConfig, array)
#30 /srv/mediawiki/php-1.41.0-wmf.25/includes/parser/Parsoid/ParsoidOutputAccess.php(244): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->parse(MediaWiki\Page\PageStoreRecord, ParserOptions, array, MediaWiki\Revision\RevisionStoreRecord)
#31 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(746): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->getParserOutput(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\RevisionStoreRecord, integer)
#32 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(574): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal(ParserOptions)
#33 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(670): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#34 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Handler/ParsoidHandler.php(918): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getPageBundle()
#35 /srv/mediawiki/php-1.41.0-wmf.25/vendor/wikimedia/parsoid/extension/src/Rest/Handler/PageHandler.php(92): MediaWiki\Rest\Handler\ParsoidHandler->wt2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array)
#36 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Router.php(517): MWParsoid\Rest\Handler\PageHandler->execute()
#37 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/Router.php(422): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\PageHandler)
#38 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/EntryPoint.php(195): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#39 /srv/mediawiki/php-1.41.0-wmf.25/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#40 /srv/mediawiki/php-1.41.0-wmf.25/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#41 /srv/mediawiki/w/rest.php(3): require(string)
#42 {main}
Impact
Notes

Details

Request URL
https://en.wikipedia.org/w/rest.php/en.wikipedia.org/v3/page/pagebundle/Shringara-manjari-katha/1169805422

Event Timeline

A slightly different version (seen 600 times last week):

Invariant failed: Bad UTF-8 at end of string (2 byte sequence)
	
from /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/assert/src/Assert.php(231)
#0 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Utils/PHPUtils.php(200): Wikimedia\Assert\Assert::invariant(boolean, string)
#1 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/DOMRangeBuilder.php(965): Wikimedia\Parsoid\Utils\PHPUtils::safeSubstr(string, integer, integer)
#2 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/DOMRangeBuilder.php(1282): Wikimedia\Parsoid\Wt2Html\PP\Processors\DOMRangeBuilder->encapsulateTemplates(array)
#3 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/WrapTemplates.php(21): Wikimedia\Parsoid\Wt2Html\PP\Processors\DOMRangeBuilder->execute(Wikimedia\Parsoid\DOM\Element)
#4 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(157): Wikimedia\Parsoid\Wt2Html\PP\Processors\WrapTemplates->run(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\DOM\Element, array, boolean)
#5 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(939): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Wikimedia\Parsoid\DOM\Element, array, boolean)
#6 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(980): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(Wikimedia\Parsoid\DOM\Element)
#7 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(998): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(Wikimedia\Parsoid\DOM\Element)
#8 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#9 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(299): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#10 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(164): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#11 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Parsoid.php(199): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#12 /srv/mediawiki/php-1.42.0-wmf.1/vendor/wikimedia/parsoid/src/Parsoid.php(240): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#13 /srv/mediawiki/php-1.42.0-wmf.1/includes/parser/Parsoid/ParsoidParser.php(151): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#14 /srv/mediawiki/php-1.42.0-wmf.1/includes/parser/Parsoid/ParsoidParser.php(279): MediaWiki\Parser\Parsoid\ParsoidParser->genParserOutput(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOptions)
#15 /srv/mediawiki/php-1.42.0-wmf.1/includes/parser/Parsoid/ParsoidOutputAccess.php(314): MediaWiki\Parser\Parsoid\ParsoidParser->parseFakeRevision(MediaWiki\Revision\MutableRevisionRecord, MediaWiki\Page\PageStoreRecord, ParserOptions)
#16 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(786): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->parseUncacheable(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\MutableRevisionRecord)
#17 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(568): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal(ParserOptions)
#18 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(664): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#19 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Handler/ParsoidHandler.php(882): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getPageBundle()
#20 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Handler/TransformHandler.php(131): MediaWiki\Rest\Handler\ParsoidHandler->wt2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, string)
#21 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Router.php(517): MediaWiki\Rest\Handler\TransformHandler->execute()
#22 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/Router.php(422): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\TransformHandler)
#23 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/EntryPoint.php(195): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#24 /srv/mediawiki/php-1.42.0-wmf.1/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#25 /srv/mediawiki/php-1.42.0-wmf.1/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#26 /srv/mediawiki/w/rest.php(3): require(string)
#27 {main}

(There is also Invariant failed: Bad UTF-8 at start of string, with the same stack trace.)

Another series from this morning, all coming from https://uk.wikipedia.org/w/rest.php/uk.wikipedia.org/v3/transform/wikitext/to/pagebundle/Main_Page

Error
labels.normalized_message
[{reqId}] {exception_url}   Wikimedia\Assert\InvariantException: Invariant failed: Bad UTF-8 at end of string (2 byte sequence)
error.stack_trace
from /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/assert/src/Assert.php(231)
#0 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Utils/PHPUtils.php(199): Wikimedia\Assert\Assert::invariant(boolean, string)
#1 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/DOMRangeBuilder.php(963): Wikimedia\Parsoid\Utils\PHPUtils::safeSubstr(string, integer, integer)
#2 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/DOMRangeBuilder.php(1280): Wikimedia\Parsoid\Wt2Html\PP\Processors\DOMRangeBuilder->encapsulateTemplates(array)
#3 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/PP/Processors/WrapTemplates.php(21): Wikimedia\Parsoid\Wt2Html\PP\Processors\DOMRangeBuilder->execute(Wikimedia\Parsoid\DOM\Element)
#4 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(153): Wikimedia\Parsoid\Wt2Html\PP\Processors\WrapTemplates->run(Wikimedia\Parsoid\Config\Env, Wikimedia\Parsoid\DOM\Element, array, boolean)
#5 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(934): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->Wikimedia\Parsoid\Wt2Html\{closure}(Wikimedia\Parsoid\DOM\Element, array, boolean)
#6 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(975): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->doPostProcess(Wikimedia\Parsoid\DOM\Element)
#7 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/DOMPostProcessor.php(993): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->process(Wikimedia\Parsoid\DOM\Element)
#8 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipeline.php(180): Wikimedia\Parsoid\Wt2Html\DOMPostProcessor->processChunkily(string, array)
#9 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wt2Html/ParserPipelineFactory.php(293): Wikimedia\Parsoid\Wt2Html\ParserPipeline->parseChunkily(string, array)
#10 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(164): Wikimedia\Parsoid\Wt2Html\ParserPipelineFactory->parse(string)
#11 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Parsoid.php(199): Wikimedia\Parsoid\Wikitext\ContentModelHandler->toDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI)
#12 /srv/mediawiki/php-1.42.0-wmf.5/vendor/wikimedia/parsoid/src/Parsoid.php(240): Wikimedia\Parsoid\Parsoid->parseWikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOutput, array)
#13 /srv/mediawiki/php-1.42.0-wmf.5/includes/parser/Parsoid/ParsoidParser.php(150): Wikimedia\Parsoid\Parsoid->wikitext2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, NULL, ParserOutput)
#14 /srv/mediawiki/php-1.42.0-wmf.5/includes/parser/Parsoid/ParsoidParser.php(285): MediaWiki\Parser\Parsoid\ParsoidParser->genParserOutput(MediaWiki\Parser\Parsoid\Config\PageConfig, ParserOptions)
#15 /srv/mediawiki/php-1.42.0-wmf.5/includes/parser/Parsoid/ParsoidOutputAccess.php(293): MediaWiki\Parser\Parsoid\ParsoidParser->parseFakeRevision(MediaWiki\Revision\MutableRevisionRecord, MediaWiki\Page\PageStoreRecord, ParserOptions)
#16 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(790): MediaWiki\Parser\Parsoid\ParsoidOutputAccess->parseUncacheable(MediaWiki\Page\PageStoreRecord, ParserOptions, MediaWiki\Revision\MutableRevisionRecord, boolean)
#17 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(569): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutputInternal(ParserOptions)
#18 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php(665): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getParserOutput()
#19 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Handler/ParsoidHandler.php(741): MediaWiki\Rest\Handler\Helper\HtmlOutputRendererHelper->getPageBundle()
#20 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Handler/TransformHandler.php(131): MediaWiki\Rest\Handler\ParsoidHandler->wt2html(MediaWiki\Parser\Parsoid\Config\PageConfig, array, string)
#21 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Router.php(536): MediaWiki\Rest\Handler\TransformHandler->execute()
#22 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/Router.php(441): MediaWiki\Rest\Router->executeHandler(MWParsoid\Rest\Handler\TransformHandler)
#23 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/EntryPoint.php(195): MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#24 /srv/mediawiki/php-1.42.0-wmf.5/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#25 /srv/mediawiki/php-1.42.0-wmf.5/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#26 /srv/mediawiki/w/rest.php(3): require(string)
#27 {main}

Couple urls triggering this in the last 2 weeks

  • /w/rest.php/en.wikipedia.org/v3/page/pagebundle/Shringara-manjari-katha/1184261178
  • /w/rest.php/en.wikipedia.org/v3/page/pagebundle/Ajayapala_(Chaulukya_dynasty)/1197445390

URL triggering the "2 byte sequence" in the last 2 weeks:

  • /w/rest.php/ks.wikipedia.org/v3/page/pagebundle/%D8%B1%D9%8F%DA%A9%D9%8F%D9%86%3A511KeV/85479

Couple urls triggering this in the last 2 weeks

  • /w/rest.php/en.wikipedia.org/v3/page/pagebundle/Shringara-manjari-katha/1184261178
  • /w/rest.php/en.wikipedia.org/v3/page/pagebundle/Ajayapala_(Chaulukya_dynasty)/1197445390

These look like a real bug -- substrings are being applied to the wrong frame source. The errors are triggered on the mapframe code found on these pages. The relative offsets for parameter values for the {{sfn|...}} template found in the text attribute of the mapframe are applied to the entire page source instead of the text attribute of the mapframe attribute. Possible a bug in the Kartographer code where the frame source isn't being set and so defaults to the top-level page source?

"Small enough" reproducer:

{{Infobox book
| name             = Shringara-manjari-katha
| author           = [[Bhoja]] or another author under his patronage
| title_orig       = शृंगार मंजरी कथा / शृङ्गार मञ्जरी कथा
}}

== Scholarly interest and analysis ==
<mapframe width="400" height="400" zoom="4" longitude="80" latitude="20" text="South Asian places mentioned in the ''Shringara-manjari-katha''. The text also mentions Suvarna-dvipa ([[Sumatra]]) and Ratna-dvipa (an island near [[Java]]), besides several rivers.{{sfn|Kalpalata Munshi|1959|pp=74-77}}" >
</mapframe>

There are probably ways to optimize that, but we're probably entering character number modulo territory when doing so, so let's go with "good enough".

After investigation: the call to wikitextToDOM in the parsing of the caption should have srcOffsets passed around. I still need to make sure that I'm not missing something else in here, and also find a non-hacky way to get that info from where I am, but I should have a patch this afternoon. It is indeed a Karto issue.

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

[mediawiki/extensions/Kartographer@master] Pass srcOffsets when parsing captions/texts with Parsoid

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

Those enwiki pages look fixed now.