{"record":{"id":"7ddfe7ea2df03b06","repo":"Dogfalo/materialize","slug":"nouislider-name-is-required","errorCode":null,"errorMessage":"noUiSlider: '${name}' is required.","messagePattern":"noUiSlider: '(.+?)' is required\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":870,"sourceCode":"                valueHorizontal: 'value-horizontal',\n                valueVertical: 'value-vertical',\n                valueNormal: 'value-normal',\n                valueLarge: 'value-large',\n                valueSub: 'value-sub'\n            },\n            'useRequestAnimationFrame': true\n        };\n\n        // Run all options through a testing mechanism to ensure correct\n        // input. It should be noted that options might get modified to\n        // be handled properly. E.g. wrapping integers in arrays.\n        Object.keys(tests).forEach(function( name ){\n\n            // If the option isn't set, but it is required, throw an error.\n            if ( options[name] === undefined && defaults[name] === undefined ) {\n\n                if ( tests[name].r ) {\n                    throw new Error(\"noUiSlider: '\" + name + \"' is required.\");\n                }\n\n                return true;\n            }\n\n            tests[name].t( parsed, options[name] === undefined ? defaults[name] : options[name] );\n        });\n\n        // Forward pips options\n        parsed.pips = options.pips;\n\n        var styles = [['left', 'top'], ['right', 'bottom']];\n\n        // Pre-define the styles.\n        parsed.style = styles[parsed.dir][parsed.ort];\n        parsed.styleOposite = styles[parsed.dir?0:1][parsed.ort];\n\n        return parsed;","sourceCodeStart":852,"sourceCodeEnd":888,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L852-L888","documentation":"noUiSlider marks certain options as required (tests[name].r === true). The current build requires 'start', 'connect', 'direction', 'range', and 'behaviour'. If such an option is neither supplied by the caller nor present in the defaults map, initialization aborts with the option name interpolated into the message.","triggerScenarios":"Call noUiSlider.create() omitting any required option that has no default: most commonly 'range' or 'start'. E.g. noUiSlider.create(el, { start: 0 }) without a range, or noUiSlider.create(el, { range:{min:0,max:100} }) without start.","commonSituations":"Forgetting the range block, copying a partial config example, or destructuring options in a way that drops a required field. Also common when building options dynamically and a conditional skips setting 'range'.","solutions":["Add the named option. Identify which one from the message text where ${name} is replaced.","For 'range' supply { min, max }; for 'start' supply a number or array of initial handle positions.","Centralize a base options object that includes all required keys, then merge in overrides."],"exampleFix":"// before\nnoUiSlider.create(el, { start: 0, connect: true, direction: 'ltr', behaviour: 'tap' });\n// after\nnoUiSlider.create(el, { start: 0, connect: true, direction: 'ltr', behaviour: 'tap', range: { min: 0, max: 100 } });","handlingStrategy":"validation","validationCode":"const REQUIRED = ['start', 'connect', 'direction', 'range', 'behaviour'];\nfunction assertRequired(opts) {\n  for (const k of REQUIRED) {\n    if (opts[k] === undefined) throw new Error(`noUiSlider: '${k}' is required.`);\n  }\n}","typeGuard":"function hasAllRequired(opts) {\n  return REQUIRED.every(k => opts[k] !== undefined);\n}","tryCatchPattern":null,"preventionTips":["Keep a base options object containing all required keys and merge overrides into it.","Read the error message literally: the interpolated name tells you exactly what is missing.","Validate the options object with a schema (e.g. zod, joi) before calling create."],"tags":["nouislider","validation","configuration","required-option"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}