Dogfalo/materialize · error · Error
noUiSlider: 'limit' option must be numeric.
Error message
noUiSlider: 'limit' option must be numeric.
What it means
Thrown by testLimit when 'limit' fails isNumeric. limit caps the maximum distance between handles and must be a real finite number; strings, null, and symbolic values are rejected by isNumeric.
Source
Thrown at extras/noUiSlider/nouislider.js:614
throw new Error("noUiSlider: 'margin' option must be numeric.");
}
// Issue #582
if ( entry === 0 ) {
return;
}
parsed.margin = parsed.spectrum.getMargin(entry);
if ( !parsed.margin ) {
throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.");
}
}
function testLimit ( parsed, entry ) {
if ( !isNumeric(entry) ){
throw new Error("noUiSlider: 'limit' option must be numeric.");
}
parsed.limit = parsed.spectrum.getMargin(entry);
if ( !parsed.limit || parsed.handles < 2 ) {
throw new Error("noUiSlider: 'limit' option is only supported on linear sliders with 2 or more handles.");
}
}
function testPadding ( parsed, entry ) {
if ( !isNumeric(entry) ){
throw new Error("noUiSlider: 'padding' option must be numeric.");
}
if ( entry === 0 ) {
return;
}View on GitHub (pinned to 824e78248b)
Solutions
- Pass a number: limit: 50.
- Coerce with Number(raw) after an isFinite check.
- Omit limit to disable the cap.
Example fix
// before limit: "50" // after limit: 50
Defensive patterns
Strategy: validation
Validate before calling
if (opts.limit != null) {
const l = Number(opts.limit);
if (typeof opts.limit !== 'number' || !Number.isFinite(l)) throw new TypeError('limit must be a number');
opts.limit = l;
} Type guard
function isLimit(v) { return typeof v === 'number' && Number.isFinite(v); } Try / catch
try { noUiSlider.create(el, opts); }
catch (e) { if (/limit' option must be numeric/.test(e.message)) { opts.limit = Number(opts.limit); /* retry */ } else throw e; } Prevention
- Coerce string sources with Number() before assignment.
- Omit limit rather than passing null/undefined explicitly.
- Type limit as number | undefined in your config interface.
When it happens
Trigger: limit: '50', limit: null, limit: 'max', limit: NaN.
Common situations: String from DOM/JSON, null used as a 'disabled' marker, or a symbolic placeholder that was never converted.
Related errors
- noUiSlider: 'range' contains invalid value.
- noUiSlider: 'limit', 'margin' and 'padding' must be divisibl
- noUiSlider: 'step' is not numeric.
- noUiSlider: 'animationDuration' option must be a number.
- noUiSlider: 'margin' option must be numeric.
AI-assisted analysis of Dogfalo/materialize@824e78248b (2026-08-13).
Data as JSON: /api/errors/eaaaa0ae6ff07eb0.
Report an issue: GitHub.