{"record":{"id":"b937b69d60eac521","repo":"Dogfalo/materialize","slug":"nouislider-orientation-option-is-invalid","errorCode":null,"errorMessage":"noUiSlider: 'orientation' option is invalid.","messagePattern":"noUiSlider: 'orientation' option is invalid\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":589,"sourceCode":"            connect = entry;\n        }\n\n        parsed.connect = connect;\n    }\n\n    function testOrientation ( parsed, entry ) {\n\n        // Set orientation to an a numerical value for easy\n        // array selection.\n        switch ( entry ){\n            case 'horizontal':\n                parsed.ort = 0;\n                break;\n            case 'vertical':\n                parsed.ort = 1;\n                break;\n            default:\n                throw new Error(\"noUiSlider: 'orientation' option is invalid.\");\n        }\n    }\n\n    function testMargin ( parsed, entry ) {\n\n        if ( !isNumeric(entry) ){\n            throw new Error(\"noUiSlider: 'margin' option must be numeric.\");\n        }\n\n        // Issue #582\n        if ( entry === 0 ) {\n            return;\n        }\n\n        parsed.margin = parsed.spectrum.getMargin(entry);\n\n        if ( !parsed.margin ) {\n            throw new Error(\"noUiSlider: 'margin' option is only supported on linear sliders.\");","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L571-L607","documentation":"Thrown by the default case of testOrientation's switch. Only the exact strings 'horizontal' and 'vertical' are accepted; this version has no 'ltr'/'rtl' token and no fallback, so an unrecognized or undefined value lands in default and throws.","triggerScenarios":"orientation: 'h', orientation: 'vert', orientation: 'top', or explicitly passing orientation: undefined into the test.","commonSituations":"Abbreviating the string, passing an enum/constant that resolved to undefined, or a version mismatch where code expects newer 'ltr'/'rtl' tokens that this build does not support.","solutions":["Use the exact strings 'horizontal' or 'vertical'.","Omit orientation entirely so the default applies (do not pass undefined explicitly).","Guard upstream: if (!['horizontal','vertical'].includes(o)) o = 'horizontal'."],"exampleFix":"// before\norientation: 'h'\n// after\norientation: 'horizontal'","handlingStrategy":"validation","validationCode":"const VALID = ['horizontal', 'vertical'];\nif (opts.orientation != null && !VALID.includes(opts.orientation)) {\n  opts.orientation = opts.orientation === undefined ? opts.orientation : 'horizontal';\n  if (!VALID.includes(opts.orientation)) throw new Error(\"orientation must be 'horizontal' or 'vertical'\");\n}","typeGuard":"function isOrientation(v) { return v === 'horizontal' || v === 'vertical'; }","tryCatchPattern":"try { noUiSlider.create(el, opts); }\ncatch (e) { if (/orientation' option is invalid/.test(e.message)) { delete opts.orientation; /* retry with default */ } else throw e; }","preventionTips":["Restrict orientation to the two exact literals at the config source.","Do not pass undefined explicitly; omit the key to use the default.","Check the library version if you expect 'ltr'/'rtl' tokens."],"tags":["config","validation","orientation"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}