OrchardCMS/OrchardCore · error · Error

msg

Error message

msg

What it means

jQuery.error is jQuery's generic error-raising helper: it simply throws a new Error with the supplied message. It is the internal mechanism behind many jQuery failures (e.g. via $.fn.html template parsing or Deferred exception propagation), so this throw site means some jQuery code path called $.error('...') with a specific message.

Solutions

  1. Read the full Error message and stack below this frame to find the jQuery API that called $.error; fix the arguments passed there.
  2. Wrap the offending jQuery call in try/catch to intercept the thrown Error and log/report it.
  3. Check jQuery upgrade notes if a previously-working call now throws; behavior can change between 3.5.1 and 3.6.0.

Example fix

// before
$('#el').html(someUntrustedString); // may surface via $.error
// after
try {
  $('#el').html(someUntrustedString);
} catch (e) {
  console.error('jQuery call failed:', e.message);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate inputs to jQuery APIs before calling them:
if (typeof selectorOrHtml !== 'string' || !selectorOrHtml.trim()) {
  throw new Error('Refusing to call jQuery with empty/invalid input');
}

Type guard

function isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; }

Try / catch

try { $(input).doSomething(); } catch (e) { if (e instanceof Error && e.message) { report('jQuery $.error thrown: ' + e.message); } else { throw e; } }

Prevention

When it happens

Trigger: Any internal jQuery code path that detects a bad input and calls $.error(message) — e.g. malformed template/HTML passed to html(), unsupported selector cases routed to error(), or invalid arguments to methods that delegate their failure reporting to jQuery.error.

Common situations: Reading a stack trace where the top frame is jQuery.error and the real message is in the thrown Error's message property; the actual offending call is the second frame in the stack, not line 334 itself.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/1084893f8fb26135. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore.Modules/OrchardCore.Resources/wwwroot/Vendor/jquery-3.5.1/jquery.js:334

				}
			}
		}
	}

	// Return the modified object
	return target;
};

jQuery.extend( {

	// Unique for each copy of jQuery on the page
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),

	// Assume jQuery is ready without the ready module
	isReady: true,

	error: function( msg ) {
		throw new Error( msg );
	},

	noop: function() {},

	isPlainObject: function( obj ) {
		var proto, Ctor;

		// Detect obvious negatives
		// Use toString instead of jQuery.type to catch host objects
		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
			return false;
		}

		proto = getProto( obj );

		// Objects with no prototype (e.g., `Object.create( null )`) are plain
		if ( !proto ) {
			return true;

View on GitHub (pinned to 4306c0717f)