Error
- service.version: 1.43.0-wmf.16
- trace.id: eab3e546-8463-4102-b8a3-e86433c1d9a8
- Find trace.id in Logstash
[{reqId}] {exception_url} Wikimedia\Assert\InvariantException: Invariant failed: Bad UTF-8 at start of string
from /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/assert/src/Assert.php(231) #0 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Utils/PHPUtils.php(172): Wikimedia\Assert\Assert::invariant(boolean, string) #1 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Tokens/SourceRange.php(85): Wikimedia\Parsoid\Utils\PHPUtils::safeSubstr(string, integer, integer) #2 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(409): Wikimedia\Parsoid\Tokens\SourceRange->substr(string) #3 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/Separators.php(899): Wikimedia\Parsoid\Html2Wt\SerializerState->getOrigSrc(Wikimedia\Parsoid\Tokens\SourceRange) #4 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(571): Wikimedia\Parsoid\Html2Wt\Separators->buildSep(Wikimedia\Parsoid\DOM\Element) #5 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(614): Wikimedia\Parsoid\Html2Wt\SerializerState->emitSepForNode(Wikimedia\Parsoid\DOM\Element) #6 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1206): Wikimedia\Parsoid\Html2Wt\SerializerState->emitChunk(Wikimedia\Parsoid\Html2Wt\ConstrainedText\ConstrainedText, Wikimedia\Parsoid\DOM\Element) #7 [internal function]: Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNodeInternal(Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\HeadingHandler) #8 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1331): call_user_func(array, Wikimedia\Parsoid\DOM\Element, Wikimedia\Parsoid\Html2Wt\DOMHandlers\HeadingHandler) #9 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(718): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeNode(Wikimedia\Parsoid\DOM\Element) #10 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SerializerState.php(744): Wikimedia\Parsoid\Html2Wt\SerializerState->serializeChildren(Wikimedia\Parsoid\DOM\Element, NULL) #11 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/WikitextSerializer.php(1595): Wikimedia\Parsoid\Html2Wt\SerializerState->kickOffSerialize(Wikimedia\Parsoid\DOM\Element) #12 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Html2Wt/SelectiveSerializer.php(227): Wikimedia\Parsoid\Html2Wt\WikitextSerializer->serializeDOM(Wikimedia\Parsoid\DOM\Element, boolean) #13 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Wikitext/ContentModelHandler.php(229): Wikimedia\Parsoid\Html2Wt\SelectiveSerializer->serializeDOM(Wikimedia\Parsoid\DOM\Document) #14 /srv/mediawiki/php-1.43.0-wmf.16/vendor/wikimedia/parsoid/src/Parsoid.php(391): Wikimedia\Parsoid\Wikitext\ContentModelHandler->fromDOM(Wikimedia\Parsoid\Ext\ParsoidExtensionAPI, Wikimedia\Parsoid\Core\SelserData) #15 /srv/mediawiki/php-1.43.0-wmf.16/includes/parser/Parsoid/HtmlToContentTransform.php(613): Wikimedia\Parsoid\Parsoid->dom2wikitext(MediaWiki\Parser\Parsoid\Config\PageConfig, Wikimedia\Parsoid\DOM\Document, array, Wikimedia\Parsoid\Core\SelserData) #16 /srv/mediawiki/php-1.43.0-wmf.16/includes/parser/Parsoid/HtmlToContentTransform.php(593): MediaWiki\Parser\Parsoid\HtmlToContentTransform->htmlToText() #17 /srv/mediawiki/php-1.43.0-wmf.16/includes/Rest/Handler/Helper/HtmlInputTransformHelper.php(562): MediaWiki\Parser\Parsoid\HtmlToContentTransform->htmlToContent() #18 /srv/mediawiki/php-1.43.0-wmf.16/extensions/VisualEditor/includes/DirectParsoidClient.php(203): MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper->getContent() #19 /srv/mediawiki/php-1.43.0-wmf.16/extensions/VisualEditor/includes/ApiParsoidTrait.php(121): MediaWiki\Extension\VisualEditor\DirectParsoidClient->transformHTML(MediaWiki\Title\Title, LanguageAr, string, integer, string) #20 /srv/mediawiki/php-1.43.0-wmf.16/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(251): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->transformHTML(MediaWiki\Title\Title, string, integer, string) #21 /srv/mediawiki/php-1.43.0-wmf.16/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(225): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->getWikitextNoCache(MediaWiki\Title\Title, array, array) #22 /srv/mediawiki/php-1.43.0-wmf.16/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(413): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->getWikitext(MediaWiki\Title\Title, array, array) #23 /srv/mediawiki/php-1.43.0-wmf.16/includes/api/ApiMain.php(1954): MediaWiki\Extension\VisualEditor\ApiVisualEditorEdit->execute() #24 /srv/mediawiki/php-1.43.0-wmf.16/includes/api/ApiMain.php(930): ApiMain->executeAction() #25 /srv/mediawiki/php-1.43.0-wmf.16/includes/api/ApiMain.php(901): ApiMain->executeActionWithErrorHandling() #26 /srv/mediawiki/php-1.43.0-wmf.16/includes/api/ApiEntryPoint.php(153): ApiMain->execute() #27 /srv/mediawiki/php-1.43.0-wmf.16/includes/MediaWikiEntryPoint.php(200): MediaWiki\Api\ApiEntryPoint->execute() #28 /srv/mediawiki/php-1.43.0-wmf.16/api.php(44): MediaWiki\MediaWikiEntryPoint->run() #29 /srv/mediawiki/w/api.php(3): require(string) #30 {main}
Notes
First seen in wmf.16. Other errors with the same generic symptom ("Invariant failed: Bad UTF-8 at start of string") were present in previous versions, but are unrelated.
We're currently seeing ~1K of these a day, which adds a bit of noise to the logs.
It looks like this change could be the cause: https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/1057922