Page MenuHomePhabricator

On Wikimedia Commons: Uncaught TypeError: can't access property "getSelection", surface is null
Closed, ResolvedPublicPRODUCTION ERROR

Description

Steps to replicate the issue (include links if applicable):

  • Go to a file page (bug confirmed at least for user page too
  • Edit the page with the Visual Editor
  • Save the pahe

What happens?:

  • The page is saved
  • An JavaScript error popped up and is shown in the Firefix console

Screenshot 2025-12-22 123855.png (616×451 px, 50 KB)

Screenshot 2025-12-22 123938.png (185×862 px, 20 KB)

What should have happened instead?:

No error should pop up

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

This happens since the last deployment of the train to 1.46.0-wmf.7

Event Timeline

Restricted Application changed the subtype of this task from "Bug Report" to "Production Error". · View Herald TranscriptDec 22 2025, 11:47 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I can reproduce this on my user sandbox page (though without the red popup – it just shows up in the console); &debug=2 shows the error comes from ve.ce.SelectionManager.prototype.updateDeactivatedSelection. I think that ce.SelectionManager: check for being destroyed in debounced methods, which IIUC made the selection nullable, seems like a likely “culprit”, so tagging @DLynch.

Ah, still a debounce issue, just methods being called on a timeout from outside of the manager.

Change #1220381 had a related patch set uploaded (by DLynch; author: DLynch):

[VisualEditor/VisualEditor@master] ce.SelectionManager: check for null surfaces

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

It's a production-error, but it's probably not worth an emergency backport -- it's from a setTimeout after a save has succeeded, a failed attempt to act on an already-destroyed editor surface, so it's basically log-spam that has no visible effect for a user who doesn't have debug tools turned on.

Change #1220381 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] ce.SelectionManager: check for null surfaces

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

Change #1223291 had a related patch set uploaded (by DLynch; author: DLynch):

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

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

Change #1223291 merged by jenkins-bot:

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

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

@DLynch could this be backported today? If you can't, I'm happy to help with that if you prepare the patches I need to backport.

Change #1223716 had a related patch set uploaded (by Jdlrobson; author: DLynch):

[mediawiki/extensions/VisualEditor@wmf/1.46.0-wmf.7] Update VE core submodule to master (f53cf0905)

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

Change #1223716 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@wmf/1.46.0-wmf.7] Update VE core submodule to master (f53cf0905)

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

Mentioned in SAL (#wikimedia-operations) [2026-01-06T22:13:18Z] <jdlrobson@deploy2002> Started scap sync-world: Backport for [[gerrit:1223715|Update VE core submodule to master (24389ad60)]], [[gerrit:rMW1223716aac25|Update VE core submodule to master (f53cf0905) (T413356)]]

Mentioned in SAL (#wikimedia-operations) [2026-01-06T22:15:44Z] <jdlrobson@deploy2002> jdlrobson: Backport for [[gerrit:1223715|Update VE core submodule to master (24389ad60)]], [[gerrit:rMW1223716aac25|Update VE core submodule to master (f53cf0905) (T413356)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2026-01-06T22:23:35Z] <jdlrobson@deploy2002> Finished scap sync-world: Backport for [[gerrit:1223715|Update VE core submodule to master (24389ad60)]], [[gerrit:rMW1223716aac25|Update VE core submodule to master (f53cf0905) (T413356)]] (duration: 10m 17s)