Page MenuHomePhabricator

"TypeError: Failed to construct 'URL': Invalid URL" from VisualEditor section edit link code
Closed, ResolvedPublicPRODUCTION ERROR

Description

https://logstash.wikimedia.org/goto/1567c2583e8688288ad17e856d378116

image.png (521×2 px, 60 KB)

Stack traces involve setupEditLinks() and onEditSectionLinkClick().

These errors shouldn't be possible, we should add detailed error logging to see what values it's trying to construct URLs with.

Event Timeline

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

[mediawiki/extensions/VisualEditor@master] Error logging for native URL errors

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

DLynch subscribed.

Patch is merging; we'll want to wait for this to roll out on the train and then for logging to actually happen, I assume.

Change 884268 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Error logging for native URL errors

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

Query for the new error logging: https://logstash.wikimedia.org/goto/c9fceba5da8bb2545325653fe934c498

Errors are either URL error when parsing value: "" or URL error when parsing value: undefined.

I found a way to trigger URL error when parsing value: undefined: when DiscussionTools is disabled, 2017WTE is enabled, and you click "Add topic" (not in Vector sticky header) on a page where VE is also available. Somehow I don't think that's a common situation… but let's start with that.

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

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Fix init from "Add topic" tab in some cases

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

I think most of these errors are caused by gadgets that add things indistinguishable from section edit links. For example (assuming again that DiscussionTools is disabled, 2017WTE is enabled), the error logging triggers on https://meta.wikimedia.org/wiki/Community_Wishlist_Survey/Sandbox when clicking the "Add topic" link added to the last section by the gadget https://meta.wikimedia.org/wiki/MediaWiki:Gadget-AddTopic.js:

image.png (2×3 px, 550 KB)

We should probably just ignore empty/undefined targets on these links.

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

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Ignore fake section edit links added by gadgets

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

Change 888801 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Fix init from "Add topic" tab in some cases

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

Change 888805 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: Ignore fake section edit links added by gadgets

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