Page MenuHomePhabricator

Error: Bad constructor arguments
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
Error: Bad constructor arguments
exception.trace
at Uri https://hu.wikipedia.org/w/load.php?lang=hu&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CimpressionDiet%2CkvStore%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cite.ux-enhancements%7Cext.cx.entrypoints.contributionsmenu%7Cext.cx.eventlogging.campaigns%7Cext.cx.icons%7Cext.cx.interlanguagelink.init%7Cext.cx.widgets.callout%7Cext.dismissableSiteNotice%2CeventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.echo.api%2Cinit%7Cext.flaggedRevs.advanced%2Creview%7Cext.growthExperiments.AddLink.onboarding%7Cext.growthExperiments.Help%2CHelpPanel%2CSuggestedEditSession%7Cext.uls.common%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7Cjquery.client%2Ccookie%2CmakeCollapsible%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cpulsatingdot%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmediawiki.ui.button%2Cicon%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-editing-advanced%2Cicons-editing-citation%2Cicons-editing-core%2Cicons-interactions%2Cicons-movement%2Cicons-user%7Cskins.vector.legacy.js%7Cuser.defaults&skin=vector&version=rvznf:855:759

at homepage/suggestededits/ext.growthExperiments.SuggestedEditSession.js/</SuggestedEditSession.prototype.updateEditingStatsConfig/</< https://hu.wikipedia.org/w/load.php?lang=hu&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CimpressionDiet%2CkvStore%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cite.ux-enhancements%7Cext.cx.entrypoints.contributionsmenu%7Cext.cx.eventlogging.campaigns%7Cext.cx.icons%7Cext.cx.interlanguagelink.init%7Cext.cx.widgets.callout%7Cext.dismissableSiteNotice%2CeventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.echo.api%2Cinit%7Cext.flaggedRevs.advanced%2Creview%7Cext.growthExperiments.AddLink.onboarding%7Cext.growthExperiments.Help%2CHelpPanel%2CSuggestedEditSession%7Cext.uls.common%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7Cjquery.client%2Ccookie%2CmakeCollapsible%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cpulsatingdot%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmediawiki.ui.button%2Cicon%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-editing-advanced%2Cicons-editing-citation%2Cicons-editing-core%2Cicons-interactions%2Cicons-movement%2Cicons-user%7Cskins.vector.legacy.js%7Cuser.defaults&skin=vector&version=rvznf:279:443

at each https://hu.wikipedia.org/w/load.php?lang=hu&modules=ext.centralNotice.choiceData%2Cdisplay%2CgeoIP%2CimpressionDiet%2CkvStore%2CstartUp%7Cext.centralauth.ForeignApi%7Cext.centralauth.centralautologin.clearcookie%7Cext.cite.ux-enhancements%7Cext.cx.entrypoints.contributionsmenu%7Cext.cx.eventlogging.campaigns%7Cext.cx.icons%7Cext.cx.interlanguagelink.init%7Cext.cx.widgets.callout%7Cext.dismissableSiteNotice%2CeventLogging%2CnavigationTiming%2CwikimediaEvents%7Cext.echo.api%2Cinit%7Cext.flaggedRevs.advanced%2Creview%7Cext.growthExperiments.AddLink.onboarding%7Cext.growthExperiments.Help%2CHelpPanel%2CSuggestedEditSession%7Cext.uls.common%2Cinterface%2Cpreferences%2Cwebfonts%7Cjquery%2Coojs%2Coojs-router%2Coojs-ui-core%2Coojs-ui-widgets%2Coojs-ui-windows%2Csite%7Cjquery.client%2Ccookie%2CmakeCollapsible%2CtextSelection%7Cjquery.uls.data%7Cmediawiki.ForeignApi%2CString%2CTitle%2CUri%2Capi%2Cbase%2Ccldr%2Ccookie%2Cexperiments%2CjqueryMsg%2Clanguage%2Cpulsatingdot%2Cstorage%2Ctoc%2Cuser%2Cutil%2CvisibleTimeout%7Cmediawiki.ForeignApi.core%7Cmediawiki.editfont.styles%7Cmediawiki.libs.pluralruleparser%7Cmediawiki.page.ready%7Cmediawiki.page.watch.ajax%7Cmediawiki.ui.button%2Cicon%7Cmmv.bootstrap%2Chead%7Cmmv.bootstrap.autostart%7Coojs-ui-widgets.icons%7Coojs-ui-windows.icons%7Coojs-ui.styles.icons-editing-advanced%2Cicons-editing-citation%2Cicons-editing-core%2Cicons-interactions%2Cicons-movement%2Cicons-user%7Cskins.vector.legacy.js%7Cuser.defaults&skin=vector&version=rvznf:308:278
...
Impact

At time of this writing, 137 errors in last 12 hours. Most coming from 1 IP address though.

Notes

Looks like bad arguments are being passed to mediawiki.Uri/Uri.js

Related Objects

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Urbanecm_WMF subscribed.

Comes from the add a link feature. Can be reproduced by making an edit on huwiki.

The affected code is

if ( this.path && this.path[0] !== '/' ) {
    throw new Error( 'Bad constructor arguments' );
}
if ( !( this.protocol && this.host && this.path ) ) {
    throw new Error( 'Bad constructor arguments' );
}

(I think the second branch specifically but not sure how accurate line offsets are)
and the caller is

$( '#ca-edit a, a#ca-edit, #ca-ve-edit a, a#ca-ve-edit, .mw-editsection a').each( function () {
    var linkUrl = new mw.Uri( $( this ).attr( 'href' ) );
    ...
} );

in SuggestedEditSession.updateEditingStatsConfig(). The lazy fix is to just do a try..catch.

Change 713970 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/GrowthExperiments@master] SuggestedEditSession: Handle errors in mw.Uri constructor

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

Change 713970 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] SuggestedEditSession: Avoid errors in mw.Uri constructor

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

Etonkovidova claimed this task.
Etonkovidova subscribed.

Checked in wmf.20 - the error is not present.