{"record":{"id":"8151db45f1bf45b4","repo":"SeleniumHQ/selenium","slug":"num-is-not-less-than-or-equal-to-max","errorCode":null,"errorMessage":"#{num} is not less than or equal to #{max}","messagePattern":"#(.+?) is not less than or equal to #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb","lineNumber":56,"sourceCode":"            next unless @opts.key?(key)\n\n            name = val.keys.first\n            values = val.values.first\n            hash[name] = assert_number(@opts[key], values[:min], values[:max])\n          end\n        end\n\n        private\n\n        def assert_number(num, min, max = nil)\n          return if num.nil?\n\n          klass = min.is_a?(Integer) ? Integer : Numeric\n          raise TypeError, \"#{num} is not a #{klass}\" unless num.is_a?(klass)\n\n          raise ArgumentError, \"#{num} is not greater than or equal to #{min}\" if num < min\n\n          raise ArgumentError, \"#{num} is not less than or equal to #{max}\" if max && num > max\n\n          num\n        end\n      end # PointerEventProperties\n    end # Interactions\n  end # WebDriver\nend # Selenium\n","sourceCodeStart":38,"sourceCodeEnd":64,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/interactions/pointer_event_properties.rb#L38-L64","documentation":"Raised as ArgumentError by PointerEventProperties.assert_number when a property value exceeds the property's documented maximum (only when VALID defines a max for that property). Maxima: pressure 1.0, tangential_pressure 1.0, tilt_x/tilt_y 90, twist 359, altitude_angle PI/2, azimuth_angle 2*PI. width/height have no max so this branch is skipped for them.","triggerScenarios":"Passing an out-of-range-high value: pressure: 1.1, tilt_x: 91, twist: 360, azimuth_angle: 7.0, altitude_angle: 2.0.","commonSituations":"Stylus automation with computed angles exceeding physical range; twist given as 0–360 then a value of exactly 360 (max is 359); radians-vs-degrees confusion for altitude/azimuth (these take radians, not degrees).","solutions":["Clamp to the property's max with [val, max_val].min using the VALID table (twist max 359, tilt ±90, pressure/tangential_pressure ≤1, altitude ≤ π/2, azimuth ≤ 2π).","Double-check units: altitude_angle and azimuth_angle are radians, not degrees.","Use modulo where it makes physical sense (e.g. azimuth_angle: val % (2 * Math::PI))."],"exampleFix":"# before\ndriver.action.pointer_down(:pen_contact, twist: 360).perform # => ArgumentError: 360 is not less than or equal to 359\n\n# after\ndriver.action.pointer_down(:pen_contact, twist: 360 % 360).perform","handlingStrategy":"validation","validationCode":"VALID = Selenium::WebDriver::Interactions::PointerEventProperties::VALID\ndef clamped_max(prop, val)\n  return nil if val.nil?\n  max = VALID[prop].values.first[:max]\n  return val unless max\n  val > max ? max : val\nend\n\ndriver.action.pointer_down(:pen_contact, twist: clamped_max(:twist, computed)).perform","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp to each property's max (twist 359, tilt ±90, pressure/tangential_pressure 1, altitude π/2, azimuth 2π).","altitude_angle/azimuth_angle take radians, not degrees — verify units before passing."],"tags":["interactions","pointer-properties","range-validation","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}