Page MenuHomePhabricator

Error: ve.dm.Document.getBranchNodeFromOffset(): offset -1 is out of bounds / Error: Invalid start offset: -1
Closed, ResolvedPublicBUG REPORT

Description

Screen Shot 2022-02-22 at 8.14.00 PM.png (378×2 px, 57 KB)

New error introduced on 16th February 2022.
https://logstash.wikimedia.org/goto/a6834c523182f8d036e7b0ea3dcf708b

I'm seeing 2,167 errors a day, so this by our criteria this should hold this week's (if this is a real user-facing error) or more likely next week's train [1]:

at VeDmDocument.ve.dm.Document.getBranchNodeFromOffset  URL1:293:946
at VeDmSurface.ve.dm.Surface.setSelection  URL1:239:441
at VeDmSurface.ve.dm.Surface.setLinearSelection  URL1:237:620
at VeCeSurface.ve.ce.Surface.selectFirstVisibleStartContentOffset  URL1:570:98
at VeCeSurface.ve.ce.Surface.focus  URL1:505:376
at VeInitMwDesktopArticleTarget.ve.init.mw.DesktopArticleTarget.afterActivate  URL1:942:11
at Array.<anonymous>  URL1:941:302
at fire  URL2:46:934
at Object.fireWith [as resolveWith]  URL2:48:135
at URL2:52:124

URL1: https://en.wikipedia.org/w/load.php?lang=en&modules=ext.visualEditor.articleTarget%2Cbase%2Ccore%2CdesktopArticleTarget%2CdesktopTarget%2Cdiffing%2Cicons%2Clanguage%2Cmediawiki%2Cmwalienextension%2Cmwcore%2Cmwextensions%2Cmwformatting%2Cmwgallery%2Cmwimage%2Cmwlanguage%2Cmwlink%2Cmwmeta%2Cmwsave%2Cmwsignature%2Cmwtransclusion%2Csanitize%2Cwelcome%7Cext.visualEditor.core.desktop%2Cutils%7Cext.visualEditor.mwextensions.desktop%7Cext.visualEditor.mwimage.core&skin=vector&version=1nv72
URL2: https://en.wikipedia.org/w/load.php?lang=en&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets%7Cjquery.ui%7Coojs-ui.styles.icons-editing-advanced&skin=vector&version=1wjpy

The error Error: Invalid start offset: -1 began at the same time. May be unrelated, please split out if so.

at VeDmDocument.ve.Document.selectNodes  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:11:647
at VeDmSurfaceFragment.ve.dm.SurfaceFragment.getLeafNodes  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:189:782
at VeDmSurfaceFragment.ve.dm.SurfaceFragment.getSelectedLeafNodes  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:189:939
at VeDmSurfaceFragment.ve.dm.SurfaceFragment.hasMatchingAncestor  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:190:916
at VeUiMWHeading2FormatTool.ve.ui.FormatTool.onUpdateState  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:825:110
at VeUiPositionedTargetToolbar.OO.EventEmitter.emit  <anonymous>:1321:656
at VeUiPositionedTargetToolbar.ve.ui.Toolbar.updateToolState  https://www.mediawiki.org/w/load.php?lang=en&modules=ext.visualEditor.core%2CdesktopArticleTarget%2Cmwtransclusion&skin=vector-2022&version=4v2y2:625:182
at later  https://www.mediawiki.org/w/load.php?lang=en&modules=oojs-ui-core%2Coojs-ui-widgets%7Coojs-ui.styles.icons-editing-advanced&skin=vector-2022&version=7cfyy:3:240

If that error is the same, the rate of errors increases [2] and the frequency is actually much higher (4240 per day).

[1] https://wikitech.wikimedia.org/wiki/Deployments/Holding_the_train#Issues_that_hold_the_train
[2] https://logstash.wikimedia.org/app/dashboards#/view/AXDBY8Qhh3Uj6x1zCF56?_g=h@9928d52&_a=h@52b5a29

Event Timeline

Jdlrobson renamed this task from Error: ve.dm.Document.getBranchNodeFromOffset(): offset -1 is out of bounds to Error: ve.dm.Document.getBranchNodeFromOffset(): offset -1 is out of bounds / Error: Invalid start offset: -1 .Feb 23 2022, 4:25 AM
Jdlrobson updated the task description. (Show Details)

Change 765258 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[VisualEditor/VisualEditor@master] ve.ce.Surface: Fix error on load when document has no content offsets

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

Reproducible on https://www.mediawiki.org/wiki/Project:Sandbox?veaction=edit (but doesn't occur on most pages). The error doesn't seem to have any impact on users (luckily), so I'm not planning to backport fixes.

It occurs when you try to edit a page that has some content, but no text, and so we fail when trying to place the text cursor in the document. It's caused by the recent work on compatibility with Vector sticky header (which required us to change the logic for the initial cursor placement – previously it was always placed at the beginning of the page, which isn't great when the user opens the editor while scrolled down).

Change 765258 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] ve.ce.Surface: Fix error on load when document has no content offsets

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

Change 765312 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a75d285a8)

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

Change 765312 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (a75d285a8)

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