Page MenuHomePhabricator

TypeError: Failed to construct 'URL': Invalid URL
Closed, ResolvedPublicPRODUCTION ERROR

Description

https://logstash.wikimedia.org/app/dashboards#/view/AXDBY8Qhh3Uj6x1zCF56?_g=h@218e8f9&_a=h@42b0446
633 errors in last 7 days

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

What happens?:

JS error:

Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at HTMLAnchorElement.eval (ve.init.mw.DesktopArticleTarget.init.js:476:20)
    at jQuery.each (jquery.js:383:19)
    at jQuery.fn.init.each (jquery.js:205:17)
    at scrollToSection (ve.init.mw.DesktopArticleTarget.init.js:475:81)
    at activateTarget (ve.init.mw.DesktopArticleTarget.init.js:584:4)
    at HTMLDocument.eval (ve.init.mw.DesktopArticleTarget.init.js:1511:5)
    at mightThrow (jquery.js:3489:29)
    at process (jquery.js:3557:12)

What should have happened instead?:

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

Other information (browser name/version, screenshots, etc.):

Event Timeline

Restricted Application changed the subtype of this task from "Bug Report" to "Production Error". · View Herald TranscriptJul 10 2026, 11:58 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
$( '#mw-content-text .mw-editsection a:not( .mw-editsection-visualeditor )' ).each( ( i, el ) => {
	const linkUrl = new URL( el.href );

It's those "delen" links which seem to be sharing-related. (And which I assume are from a gadget, since they don't respond to uselang.)

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

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: don't assume hrefs on editsection links

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

Change #1309789 had a related patch set uploaded (by Manvi Kesarwani; author: Manvi Kesarwani):

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: safely handle invalid URLs on edit section links

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

I had also contributed in this task please review it

@Manvikesarwani09 Hi, I'm afraid there isn't much sense in duplicating existing patches. :)

Change #1309789 abandoned by Aklapper:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: safely handle invalid URLs on edit section links

Reason:

See earlier https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/1309788

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

@Aklapper When I was working on it, no one had uploaded at that time. Just before I pushed, someone else uploaded, and I only noticed after my push.
From next time I'll be more carefull.

Change #1309788 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] DesktopArticleTarget.init: don't assume hrefs on editsection links

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