{"record":{"id":"bb42e02c0859a6ab","repo":"SeleniumHQ/selenium","slug":"unknown-guard-type-type","errorCode":null,"errorMessage":"unknown guard type: #{type}","messagePattern":"unknown guard type: #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/support/guards/guard.rb","lineNumber":63,"sourceCode":"                      when Integer\n                        \"Bug Filed: #{tracker}/#{reason}\"\n                      when Symbol\n                        messages[reason]\n                      else\n                        \"#{type.to_s.tr('_', ' ')} #{guarded};\"\n                      end\n\n            case type\n            when :skip_if, :exclude\n              \"Test skipped because it breaks test run; #{details}\"\n            when :flaky\n              \"Test skipped because it is unreliable in this configuration; #{details}\"\n            when :skip_unless, :exclusive\n              \"Test does not apply to this configuration; #{details}\"\n            when :pending_if, :pending_unless, :except, :only\n              \"Test guarded; #{details}\"\n            else\n              raise ArgumentError, \"unknown guard type: #{type}\"\n            end\n          end\n\n          # Test is expected to fail on the configurations specified (marked pending).\n          def except?\n            @type == :pending_if || @type == :except\n          end\n\n          # Test is expected to fail on every configuration except those specified (marked pending).\n          def only?\n            @type == :pending_unless || @type == :only\n          end\n\n          # Test is skipped on the configurations specified because it breaks the run or is unreliable.\n          def exclude?\n            @type == :skip_if || @type == :exclude || @type == :flaky\n          end\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/support/guards/guard.rb#L45-L81","documentation":"Support::Guards::Guard#message maps a guard type Symbol to a human-readable message via a case statement covering :skip_if, :exclude, :flaky, :skip_unless, :exclusive, :pending_if, :pending_unless, :except, :only. Any other Symbol falls to the else branch and raises ArgumentError. This is internal test-infrastructure code (@api private) for RSpec integration-test guards, not user-facing library API.","triggerScenarios":"Constructing a Selenium::WebDriver::Support::Guards::Guard with an unrecognized type Symbol (anything outside the nine known guard types) and then calling #message. Typically happens only when hand-rolling guard metadata or when RSpec metadata uses a guard key not registered in spec_helper.","commonSituations":"Contributors adding a new guard type but forgetting to add its case branch; typos in guard metadata (e.g. :skipp_if); programmatically building Guard objects from external metadata. End users of the webdriver library essentially never hit this.","solutions":["Use one of the nine valid guard types: :skip_if, :exclude, :flaky, :skip_unless, :exclusive, :pending_if, :pending_unless, :except, :only.","If extending guards, add the new type to the case statement in guard.rb:53-64 before using it.","Check the guard key registered in spec/integration spec_helper matches the symbol you pass."],"exampleFix":"# before\nGuard.new(config, :skipp_if, guards).message\n\n# after\nGuard.new(config, :skip_if, guards).message","handlingStrategy":"validation","validationCode":"VALID_GUARDS = %i[skip_if exclude flaky skip_unless exclusive pending_if pending_unless except only].freeze\n\nraise ArgumentError, \"bad guard #{type}\" unless VALID_GUARDS.include?(type)\nGuard.new(config, type, guards).message","typeGuard":"def valid_guard_type?(type)\n  %i[skip_if exclude flaky skip_unless exclusive pending_if pending_unless except only].include?(type)\nend","tryCatchPattern":null,"preventionTips":["Restrict guard metadata to the nine registered types; spell-check Symbols.","If adding a new guard type, extend the case statement in guard.rb before using it.","Treat Guard as @api private — do not construct it from user test code."],"tags":["guards","testing","internal-api","argument-error","ruby"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}