{"record":{"id":"6d8105a11f48f755","repo":"Dogfalo/materialize","slug":"nouislider-range-value-isn-t-numeric","errorCode":null,"errorMessage":"noUiSlider: 'range' value isn't numeric.","messagePattern":"noUiSlider: 'range' value isn't numeric\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":303,"sourceCode":"        }\n\n        // Reject any invalid input, by testing whether value is an array.\n        if ( Object.prototype.toString.call( value ) !== '[object Array]' ){\n            throw new Error(\"noUiSlider: 'range' contains invalid value.\");\n        }\n\n        // Covert min/max syntax to 0 and 100.\n        if ( index === 'min' ) {\n            percentage = 0;\n        } else if ( index === 'max' ) {\n            percentage = 100;\n        } else {\n            percentage = parseFloat( index );\n        }\n\n        // Check for correct input.\n        if ( !isNumeric( percentage ) || !isNumeric( value[0] ) ) {\n            throw new Error(\"noUiSlider: 'range' value isn't numeric.\");\n        }\n\n        // Store values.\n        that.xPct.push( percentage );\n        that.xVal.push( value[0] );\n\n        // NaN will evaluate to false too, but to keep\n        // logging clear, set step explicitly. Make sure\n        // not to override the 'step' setting with false.\n        if ( !percentage ) {\n            if ( !isNaN( value[1] ) ) {\n                that.xSteps[0] = value[1];\n            }\n        } else {\n            that.xSteps.push( isNaN(value[1]) ? false : value[1] );\n        }\n\n        that.xHighestCompleteStep.push(0);","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L285-L321","documentation":"Thrown by handleEntryPoint after the array check passes, when either the key's derived percentage or the entry value value[0] fails isNumeric. The percentage is 0/100 for 'min'/'max' or parseFloat(key) for stop keys like '50%'; a non-parseable key or a non-numeric array element lands here. This separates 'structurally invalid' (error 0) from 'structurally OK but not a number'.","triggerScenarios":"A bad stop key: range: { min: 0, half: 50, max: 100 } (parseFloat('half') is NaN). A non-numeric array element: range: { min: [null, 1], max: 100 } or range: { min: ['x'], max: 100 }.","commonSituations":"Forgetting the trailing '%' on an intermediate stop key, declaring a stop as [step, value] in the wrong order, or pulling values from uncoerced form fields that yield null/NaN.","solutions":["Use only 'min', 'max', and 'NN%' string keys (with the trailing percent sign) for stops.","Make sure the value, or value[0] of the [value, step] array, is a real finite number.","Validate each entry with Number.isFinite before constructing the range object."],"exampleFix":"// before\nrange: { min: 0, half: 50, max: 100 }\n// after\nrange: { min: 0, '50%': 50, max: 100 }","handlingStrategy":"validation","validationCode":"function assertRangeKeysAndValues(range) {\n  for (const key of Object.keys(range)) {\n    const pct = key === 'min' ? 0 : key === 'max' ? 100 : parseFloat(key);\n    if (!Number.isFinite(pct)) throw new TypeError(\"range key '\" + key + \"' must be 'min', 'max', or 'NN%'\");\n    const v0 = Array.isArray(range[key]) ? range[key][0] : range[key];\n    if (typeof v0 !== 'number' || !Number.isFinite(v0)) throw new TypeError(\"range['\" + key + \"'] value must be numeric\");\n  }\n}","typeGuard":"const RANGE_KEY = /^(min|max|\\d+%)$/;\nfunction isRangeEntry(key, v) {\n  return RANGE_KEY.test(key) && (typeof v === 'number' || (Array.isArray(v) && typeof v[0] === 'number'));\n}","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/range' value isn't numeric/.test(e.message)) { /* fix keys/values, retry */ } else throw e; }","preventionTips":["Always suffix intermediate stop keys with '%'.","Validate the [value, step] array order: value first, step second.","Run range entries through Number.isFinite before building the slider."],"tags":["config","validation","range","numeric","initialization"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}