{"record":{"id":"dc9f4fa7e7ba4e56","repo":"OrchardCMS/OrchardCore","slug":"regexp-exec-method-returned-something-other-than-an-object-dc9f4f","errorCode":null,"errorMessage":"RegExp exec method returned something other than an Object or null","messagePattern":"RegExp exec method returned something other than an Object or null","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":878,"sourceCode":"/***/ }),\n\n/***/ \"5f1b\":\n/***/ (function(module, exports, __webpack_require__) {\n\n\"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) {","sourceCodeStart":860,"sourceCodeEnd":896,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.umd.js#L860-L896","documentation":"This TypeError is thrown by the core-js RegExp#exec polyfill in the vuedraggable UMD bundle. Per spec, R.exec(S) must return an object (the match array) or null; the polyfill enforces this and throws when exec returns a primitive or other non-object. This indicates a corrupted/incorrect RegExp-like object is being exec'd, almost always due to a broken polyfill environment or monkey-patched RegExp.","triggerScenarios":"Calling code (e.g. SortableJS internals or dependency code doing path/name parsing) with a RegExp whose exec has been overridden to return a non-object (string, number, undefined); running the UMD bundle under an environment where core-js regexp feature detection mispatches legacy RegExp features.","commonSituations":"Global polyfills (core-js 2/3 mismatch) or other libraries monkey-patching RegExp.prototype.exec; very old browsers or environments with broken Symbol/RegExp support executing the vendored UMD bundle; bundler double-polyfilling core-js.","solutions":["Audit and remove code monkey-patching RegExp.prototype.exec or returning non-objects from custom exec","Align core-js version/imports (use a single core-js 3 entry) so the polyfill isn't applied to native RegExp incorrectly","Prefer the vuedraggable.common.js ESM build over the UMD bundle in bundled apps so app polyfills don't wrap it","Reproduce with a plain page to rule out environment corruption, then upgrade core-js/browserslist targets"],"exampleFix":"// before\nconst orig = RegExp.prototype.exec;\nRegExp.prototype.exec = function (s) { return orig.call(this, s)?.[0]; }; // returns string -> TypeError\n\n// after\nRegExp.prototype.exec = function (s) { return orig.call(this, s); }; // always return match array or null","handlingStrategy":"try-catch","validationCode":"const r = re.exec(s); if (r !== null && typeof r !== 'object') console.error('custom exec returns non-object');","typeGuard":"function isSafeRegExp(v) { return Object.prototype.toString.call(v) === '[object RegExp]' && typeof v.exec === 'function'; }","tryCatchPattern":"try { const m = pattern.exec(input); } catch (e) { if (e instanceof TypeError && /RegExp exec/.test(e.message)) { pattern = new RegExp(String(source)); } else { throw e; } }","preventionTips":["Never monkey-patch RegExp.prototype.exec","Use one core-js version; avoid double polyfilling","Prefer ESM builds over vendored UMD in bundled apps","Keep custom exec implementations spec-compliant (return match array or null)"],"tags":["javascript","regexp","polyfill","core-js","vuedraggable"],"backgroundTag":"unexpected-response-shape","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"}