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
core-js's regexp-exec shim (bundled into vuedraggable.common.js) calls R.exec.call(R, S) and, per spec (RegExpExec), throws this TypeError when exec returns a non-object, non-null value (e.g. undefined, a primitive, true). It fires when code invokes a custom or patched exec whose return violates the RegExp contract, or when R is an exotic object exposing an exec method.
Solutions
- Find any overridden RegExp.prototype.exec (or object with custom exec) and ensure it returns the match array or null on every path (add `return null;` / `return result;`).
- Search the bundle/app for `RegExp.prototype.exec =` and `.exec =` patches; remove or fix the monkey-patch.
- Check for duplicate/conflicting core-js or RegExp polyfills loaded before vuedraggable; align polyfill versions.
- If passing a RegExp-like object, use a real RegExp instance instead.
- Fix test mocks so exec stubs return an array (e.g. ['match']) or null, never undefined.
Example fix
// before
const origExec = RegExp.prototype.exec;
RegExp.prototype.exec = function (s) {
console.log('exec', s);
origExec.call(this, s); // result never returned -> TypeError
};
// after
const origExec = RegExp.prototype.exec;
RegExp.prototype.exec = function (s) {
const result = origExec.call(this, s);
console.log('exec', s, result);
return result;
}; Defensive patterns
Strategy: type-guard
Validate before calling
if (re instanceof RegExp === false && !(re && typeof re.exec === 'function')) throw new TypeError('Expected a RegExp (or exec-returning RegExp-like) before match/exec'); Type guard
function isSafeRegExp(v) { return v instanceof RegExp || (v !== null && typeof v === 'object' && typeof v.exec === 'function'); } Try / catch
try { return str.match(re); } catch (e) { if (e instanceof TypeError && /RegExp exec/.test(e.message)) { console.warn('Bad RegExp receiver or patched exec; falling back to new RegExp(re.source, re.flags)'); return str.match(new RegExp(re.source, re.flags)); } throw e; } Prevention
- Never monkey-patch RegExp.prototype.exec without returning the result on every path
- Avoid loading multiple/old core-js or RegExp polyfills alongside vuedraggable
- Always construct real RegExp instances instead of RegExp-like plain objects
- Make test mocks of exec return an array or null, never undefined
- Grep the codebase for `RegExp.prototype.exec =` and `.exec =` patches during upgrades
When it happens
Trigger: Calling String.prototype.match/split/replace (internal RegExpExec) with a RegExp-like object whose exec is overridden to return undefined or a primitive; passing an object with a bogus `exec` function into code paths used by vuedraggable (e.g. drag-handle selectors or internal string parsing); monkey-patching RegExp.prototype.exec incorrectly.
Common situations: Libraries or user code patching RegExp.prototype.exec to add logging and forgetting to return the result; returning `undefined` with `return;` after a guard; polyfill conflicts where an older core-js or another polyfill defines an incompatible exec; mocking RegExp in tests with a stub returning undefined.
Related errors
- RegExp#exec called on incompatible receiver
- RegExp exec method returned something other than an Object…
- RegExp#exec called on incompatible receiver
- @@toPrimitive must return a primitive value.
- @@toPrimitive must return a primitive value.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/a287fd05c91baf95.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/vue-draggable-2.24.3/vuedraggable.common.js:869
/***/ }),
/***/ "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)