{"record":{"id":"04fc22820f9471ae","repo":"Dogfalo/materialize","slug":"nouislider-range-is-not-an-object","errorCode":null,"errorMessage":"noUiSlider: 'range' is not an object.","messagePattern":"noUiSlider: 'range' is not an object\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":478,"sourceCode":"        return value !== undefined && value.toFixed(2);\n    }, 'from': Number };\n\n    function testStep ( parsed, entry ) {\n\n        if ( !isNumeric( entry ) ) {\n            throw new Error(\"noUiSlider: 'step' is not numeric.\");\n        }\n\n        // The step option can still be used to set stepping\n        // for linear sliders. Overwritten if set in 'range'.\n        parsed.singleStep = entry;\n    }\n\n    function testRange ( parsed, entry ) {\n\n        // Filter incorrect input.\n        if ( typeof entry !== 'object' || Array.isArray(entry) ) {\n            throw new Error(\"noUiSlider: 'range' is not an object.\");\n        }\n\n        // Catch missing start or end.\n        if ( entry.min === undefined || entry.max === undefined ) {\n            throw new Error(\"noUiSlider: Missing 'min' or 'max' in 'range'.\");\n        }\n\n        // Catch equal start or end.\n        if ( entry.min === entry.max ) {\n            throw new Error(\"noUiSlider: 'range' 'min' and 'max' cannot be equal.\");\n        }\n\n        parsed.spectrum = new Spectrum(entry, parsed.snap, parsed.dir, parsed.singleStep);\n    }\n\n    function testStart ( parsed, entry ) {\n\n        entry = asArray(entry);","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L460-L496","documentation":"Thrown by testRange when 'range' is not a plain object: typeof entry !== 'object' OR Array.isArray(entry). noUiSlider needs the shape { min, max } (optionally with intermediate 'NN%' stops); a tuple, string, number, or null does not carry the required endpoint semantics.","triggerScenarios":"range: [0, 100], range: '0-100', range: 100, range: null, or range: undefined when the key is still passed.","commonSituations":"Assuming range takes a [min, max] array (common in other slider libraries), passing null to 'disable' the feature, or spreading the wrong variable into the options object.","solutions":["Use the object form: range: { min: 0, max: 100 }.","Build the object explicitly from dynamic bounds: { min: lo, max: hi }.","If range is conditional, default to a valid object instead of null."],"exampleFix":"// before\nrange: [min, max]\n// after\nrange: { min: min, max: max }","handlingStrategy":"type-guard","validationCode":"if (typeof opts.range !== 'object' || opts.range === null || Array.isArray(opts.range)) {\n  throw new TypeError('range must be a plain object { min, max }');\n}","typeGuard":"function isRangeObject(v) { return v !== null && typeof v === 'object' && !Array.isArray(v); }","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/range' is not an object/.test(e.message)) { opts.range = { min: lo, max: hi }; /* retry */ } else throw e; }","preventionTips":["Do not pass [min, max] arrays; noUiSlider uses the object form exclusively.","Default range to a valid object instead of null when the feature is optional.","Add a TypeScript type for the options object to catch shape errors at compile time."],"tags":["config","validation","range","type-error"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}