{"record":{"id":"76027451214e0ab6","repo":"ankane/pghero","slug":"nouislider-values-2-required-for-mode-cou","errorCode":null,"errorMessage":"noUiSlider: 'values' (>= 2) required for mode 'count'.","messagePattern":"noUiSlider: 'values' \\(>= 2\\) required for mode 'count'\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app/assets/javascripts/pghero/nouislider.js","lineNumber":1117,"sourceCode":"                    // Map to slider range values\n                    min = scope_Spectrum.fromStepping(min).toFixed(1);\n                    max = scope_Spectrum.fromStepping(max).toFixed(1);\n                    now = scope_Spectrum.fromStepping(now).toFixed(1);\n                    handle.children[0].setAttribute(\"aria-valuemin\", min);\n                    handle.children[0].setAttribute(\"aria-valuemax\", max);\n                    handle.children[0].setAttribute(\"aria-valuenow\", now);\n                    handle.children[0].setAttribute(\"aria-valuetext\", text);\n                });\n            });\n        }\n        function getGroup(pips) {\n            // Use the range.\n            if (pips.mode === exports.PipsMode.Range || pips.mode === exports.PipsMode.Steps) {\n                return scope_Spectrum.xVal;\n            }\n            if (pips.mode === exports.PipsMode.Count) {\n                if (pips.values < 2) {\n                    throw new Error(\"noUiSlider: 'values' (>= 2) required for mode 'count'.\");\n                }\n                // Divide 0 - 100 in 'count' parts.\n                var interval = pips.values - 1;\n                var spread = 100 / interval;\n                var values = [];\n                // List these parts and have them handled as 'positions'.\n                while (interval--) {\n                    values[interval] = interval * spread;\n                }\n                values.push(100);\n                return mapToRange(values, pips.stepped);\n            }\n            if (pips.mode === exports.PipsMode.Positions) {\n                // Map all percentages to on-range values.\n                return mapToRange(pips.values, pips.stepped);\n            }\n            if (pips.mode === exports.PipsMode.Values) {\n                // If the value must be stepped, it needs to be converted to a percentage first.","sourceCodeStart":1099,"sourceCodeEnd":1135,"githubUrl":"https://github.com/ankane/pghero/blob/7edb57986ffd36f9d64f0830c4ccc90a5eac46d6/app/assets/javascripts/pghero/nouislider.js#L1099-L1135","documentation":"When pips are requested with mode Count, noUiSlider's getGroup() divides the 0-100 range into pips.values - 1 intervals to compute pip positions. A count of 1 or 0 would mean zero or negative intervals, so values < 2 throws this Error while generating pips.","triggerScenarios":"noUiSlider.create(el, {start: [50], pips: {mode: noUiSlider.PipsMode.Count, values: 1}}) or values: 0. Frequently the value is computed dynamically (a filter count, a data series length) and can legitimately be 0 or 1.","commonSituations":"Dashboards that draw a pip per bucket where the bucket count depends on data; confusing PipsMode.Count (number of intervals + 1) with PipsMode.Positions (percent positions) or PipsMode.Values (explicit values).","solutions":["Use a count of 2 or more: pips: {mode: noUiSlider.PipsMode.Count, values: 5}","Clamp dynamic counts: values: Math.max(2, myCount)","If you actually want specific positions, switch to PipsMode.Positions with a values array like [0, 25, 50, 75, 100]"],"exampleFix":"// before\nnoUiSlider.create(el, { start: [50], pips: { mode: noUiSlider.PipsMode.Count, values: 1 } });\n\n// after\nnoUiSlider.create(el, { start: [50], pips: { mode: noUiSlider.PipsMode.Count, values: 5 } });","handlingStrategy":"validation","validationCode":"if (pips && pips.mode === noUiSlider.PipsMode.Count && !(Number(pips.values) >= 2)) {\n  pips.values = 2; // or skip pips entirely\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp dynamic pip counts with Math.max(2, n)","Remember Count mode counts intervals+1; use Positions mode for explicit percentage marks"],"tags":["nouislider","pips","validation","javascript"],"backgroundTag":"invalid-option-value","analyzedSha":"7edb57986ffd36f9d64f0830c4ccc90a5eac46d6","analyzedAt":"2026-08-21T17:33:54.942Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}