{"record":{"id":"787d6b01a8b7f868","repo":"Dogfalo/materialize","slug":"nouislider-start-option-is-incorrect","errorCode":null,"errorMessage":"noUiSlider: 'start' option is incorrect.","messagePattern":"noUiSlider: 'start' option is incorrect\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":501,"sourceCode":"            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\n        // When the slider is initialized, the .val method will\n        // be called with the start options.\n        parsed.start = entry;\n    }\n\n    function testSnap ( parsed, entry ) {\n\n        // Enforce 100% stepping within subranges.\n        parsed.snap = entry;\n\n        if ( typeof entry !== 'boolean' ){\n            throw new Error(\"noUiSlider: 'snap' option must be a boolean.\");\n        }","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L483-L519","documentation":"Thrown by testStart when, after asArray wrapping, the 'start' option is an empty array. start sets the initial handle positions and its length determines the handle count, so at least one value is required. Note the values themselves are not range-checked here (the .val method handles that), only the presence of entries.","triggerScenarios":"start: [] is the direct trigger. Also reachable via code paths that filter a source list to zero elements before passing it.","commonSituations":"Initializing the slider before selected values arrive from an API, filtering the value list down to nothing, or passing a computed array that is empty under some condition.","solutions":["Provide at least one start value within range.","Defer noUiSlider.create until the start data is non-empty.","Default to [min] (or another in-range value) when nothing is selected."],"exampleFix":"// before\nstart: selected           // selected === []\n// after\nstart: selected.length ? selected : [min]","handlingStrategy":"validation","validationCode":"const start = Array.isArray(opts.start) ? opts.start : [opts.start];\nif (!start.length) throw new Error('start must contain at least one value');\nopts.start = start;","typeGuard":"function hasStart(s) { return (Array.isArray(s) ? s : [s]).length > 0; }","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/start' option is incorrect/.test(e.message)) { opts.start = [opts.range.min]; /* retry */ } else throw e; }","preventionTips":["Defer noUiSlider.create until selected values are loaded.","Default to [min] when nothing is selected rather than passing an empty array.","Filter the source list before, not inside, the config object."],"tags":["config","validation","start","initialization"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}