{"record":{"id":"6d75d6839338d969","repo":"OrchardCMS/OrchardCore","slug":"regexp-exec-called-on-incompatible-receiver-vuedraggable-umd","errorCode":null,"errorMessage":"RegExp#exec called on incompatible receiver","messagePattern":"RegExp#exec called on incompatible receiver","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.umd.js","lineNumber":883,"sourceCode":"\"use strict\";\n\n\nvar classof = __webpack_require__(\"23c6\");\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n  var exec = R.exec;\n  if (typeof exec === 'function') {\n    var result = exec.call(R, S);\n    if (typeof result !== 'object') {\n      throw new TypeError('RegExp exec method returned something other than an Object or null');\n    }\n    return result;\n  }\n  if (classof(R) !== 'RegExp') {\n    throw new TypeError('RegExp#exec called on incompatible receiver');\n  }\n  return builtinExec.call(R, S);\n};\n\n\n/***/ }),\n\n/***/ \"613b\":\n/***/ (function(module, exports, __webpack_require__) {\n\nvar shared = __webpack_require__(\"5537\")('keys');\nvar uid = __webpack_require__(\"ca5a\");\nmodule.exports = function (key) {\n  return shared[key] || (shared[key] = uid(key));\n};\n\n\n/***/ }),","sourceCodeStart":865,"sourceCodeEnd":901,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.umd.js#L865-L901","documentation":"This TypeError is the second check in the same core-js RegExp#exec polyfill: if the receiver R isn't a real RegExp (classof(R) !== 'RegExp') and has no callable exec, calling exec on it throws 'RegExp#exec called on incompatible receiver'. It means string.match/replace/split/RegExp#exec received something RegExp-like but not an actual RegExp (e.g. undefined or a string pattern where a RegExp was expected).","triggerScenarios":"Passing undefined/null/a string as a regex argument to String.prototype.match/replace used inside vendored code; a regex created in a different realm/iframe (cross-realm RegExp fails classof check); libraries swapping RegExp for a lookalike object.","commonSituations":"Dynamic patterns built from config where the value is a plain string passed where new RegExp(pattern) is required; cross-frame code (widget inside iframe) sharing regexes; minified bundle collisions overwriting RegExp globals.","solutions":["Convert string patterns to RegExp before use: new RegExp(pattern, flags)","Don't pass regexes across iframe/window boundaries; recreate them in the target realm","Check for code that reassigns RegExp or String.prototype methods and remove it","Bypass the problematic polyfilled UMD path by importing the ESM vuedraggable build"],"exampleFix":"// before\nstr.match(pattern); // pattern is a plain string with special chars, not a RegExp\n\n// after\nstr.match(new RegExp(pattern, 'i'));","handlingStrategy":"type-guard","validationCode":"if (!(pattern instanceof RegExp)) { pattern = new RegExp(String(pattern)); }","typeGuard":"function isRegExp(v) { return Object.prototype.toString.call(v) === '[object RegExp]'; }","tryCatchPattern":"try { return regex.exec(str); } catch (e) { if (e instanceof TypeError && /incompatible receiver/.test(e.message)) { return new RegExp(regex.source, regex.flags).exec(str); } throw e; }","preventionTips":["Coerce string patterns with new RegExp","Avoid passing RegExp across iframes/realms","Don't overwrite RegExp or String.prototype methods","Sanity-check bundle integrity after minification"],"tags":["javascript","regexp","polyfill","core-js","vuedraggable"],"backgroundTag":"invalid-argument-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}