{"record":{"id":"5a5684b694dd8bf9","repo":"Dogfalo/materialize","slug":"nouislider-range-min-and-max-cannot-be-equa","errorCode":null,"errorMessage":"noUiSlider: 'range' 'min' and 'max' cannot be equal.","messagePattern":"noUiSlider: 'range' 'min' and 'max' cannot be equal\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":488,"sourceCode":"        // 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);\n\n        // Validate input. Values aren't tested, as the public .val method\n        // will always provide a valid location.\n        if ( !Array.isArray( entry ) || !entry.length ) {\n            throw new Error(\"noUiSlider: 'start' option is incorrect.\");\n        }\n\n        // Store the number of handles.\n        parsed.handles = entry.length;\n","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L470-L506","documentation":"Thrown by testRange when entry.min === entry.max. The slider needs a non-zero span to map values to positions; equal endpoints collapse every value to the same point and would divide by zero in the percentage math downstream.","triggerScenarios":"range: { min: 50, max: 50 }, dynamic config where both bounds resolve to the same number, or both defaulting to 0 before real data loads.","commonSituations":"Degenerate datasets with a single distinct value used for both bounds, an off-by-one in bound computation, or initializing the slider before the data range is known.","solutions":["Ensure max is strictly greater than min.","If data may be degenerate, expand the span: max = Math.max(min + 1, max).","Defer noUiSlider.create until bounds actually differ."],"exampleFix":"// before\nrange: { min: v, max: v }\n// after\nrange: { min: v, max: v + span }","handlingStrategy":"validation","validationCode":"if (opts.range.min === opts.range.max) {\n  throw new Error('range min and max must differ');\n}","typeGuard":null,"tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/cannot be equal/.test(e.message)) { opts.range.max = opts.range.min + 1; /* retry */ } else throw e; }","preventionTips":["Check min < max before initializing.","For dynamic data, expand the span when degenerate: max = Math.max(min + 1, max).","Defer slider creation until real bounds are loaded."],"tags":["config","validation","range"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}