OrchardCMS/OrchardCore · error · TypeError
RegExp exec method returned something other than an Object…
Error message
RegExp exec method returned something other than an Object or null
What it means
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.
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
Example fix
// before
const orig = RegExp.prototype.exec;
RegExp.prototype.exec = function (s) { return orig.call(this, s)?.[0]; }; // returns string -> TypeError
// after
RegExp.prototype.exec = function (s) { return orig.call(this, s); }; // always return match array or null Defensive patterns
Strategy: try-catch
Validate before calling
const r = re.exec(s); if (r !== null && typeof r !== 'object') console.error('custom exec returns non-object'); Type guard
function isSafeRegExp(v) { return Object.prototype.toString.call(v) === '[object RegExp]' && typeof v.exec === 'function'; } Try / catch
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; } } Prevention
- 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)
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- RegExp#exec called on incompatible receiver
- RegExp exec method returned something other than an Object…
- RegExp#exec called on incompatible receiver
- Invalid attempt to spread non-iterable instance. In order…
- Invalid attempt to destructure non-iterable instance. In…
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/dc9f4fa7e7ba4e56.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.umd.js:878
/***/ }),
/***/ "5f1b":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var classof = __webpack_require__("23c6");
var builtinExec = RegExp.prototype.exec;
// `RegExpExec` abstract operation
// https://tc39.github.io/ecma262/#sec-regexpexec
module.exports = function (R, S) {
var exec = R.exec;
if (typeof exec === 'function') {
var result = exec.call(R, S);
if (typeof result !== 'object') {
throw new TypeError('RegExp exec method returned something other than an Object or null');
}
return result;
}
if (classof(R) !== 'RegExp') {
throw new TypeError('RegExp#exec called on incompatible receiver');
}
return builtinExec.call(R, S);
};
/***/ }),
/***/ "613b":
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__("5537")('keys');
var uid = __webpack_require__("ca5a");
module.exports = function (key) {View on GitHub (pinned to 4306c0717f)