{"record":{"id":"4009a2a7117ab967","repo":"SeleniumHQ/selenium","slug":"invalid-proxy-type-type-inspect-expected-one","errorCode":null,"errorMessage":"invalid proxy type: #{type.inspect}, expected one of #{TYPES.keys.inspect}","messagePattern":"invalid proxy type: #(.+?), expected one of #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/proxy.rb","lineNumber":125,"sourceCode":"\n      def socks_username=(value)\n        self.type = :manual\n        @socks_username = value\n      end\n\n      def socks_password=(value)\n        self.type = :manual\n        @socks_password = value\n      end\n\n      def socks_version=(value)\n        self.type = :manual\n        @socks_version = value\n      end\n\n      def type=(type)\n        unless TYPES.key? type\n          raise ArgumentError,\n                \"invalid proxy type: #{type.inspect}, expected one of #{TYPES.keys.inspect}\"\n        end\n\n        if defined?(@type) && type != @type\n          raise ArgumentError, \"incompatible proxy type #{type.inspect} (already set to #{@type.inspect})\"\n        end\n\n        @type = type\n      end\n\n      def as_json(*)\n        json_result = {\n          'proxyType' => TYPES[type].downcase,\n          'httpProxy' => http,\n          'noProxy' => no_proxy.is_a?(String) ? no_proxy.split(',').map(&:strip).reject(&:empty?) : no_proxy,\n          'proxyAutoconfigUrl' => pac,\n          'sslProxy' => ssl,\n          'autodetect' => auto_detect,","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/proxy.rb#L107-L143","documentation":"Proxy#type= only accepts a Symbol that is a key in the TYPES map (:direct, :manual, :pac, :auto_detect, :system). An unknown or mistyped value raises ArgumentError and lists the valid keys. This setter is invoked indirectly by the other attribute writers (http=, ssl=, etc.) which set the type automatically.","triggerScenarios":"Calling proxy.type = 'manual' with a String instead of a Symbol. Setting proxy.type = :ftp (not a valid type). Passing an invalid type through the constructor :type key.","commonSituations":"Passing a String ('MANUAL') instead of a Symbol (:manual). Guessing a type name like :anonymous or :ftp. Confusing the internal Symbol with the W3C string representation.","solutions":["Use a Symbol from TYPES: :direct, :manual, :pac, :auto_detect, or :system.","Let the attribute writers (http=, socks=, pac=) set the type automatically instead of setting it manually.","If reading type from config, convert valid strings with .to_sym after validating against TYPES.keys."],"exampleFix":"# before\nproxy = Selenium::WebDriver::Proxy.new\nproxy.type = 'manual'\n\n# after\nproxy = Selenium::WebDriver::Proxy.new\nproxy.type = :manual","handlingStrategy":"type-guard","validationCode":"raise ArgumentError, 'invalid proxy type' unless Selenium::WebDriver::Proxy::TYPES.key?(type)","typeGuard":"def valid_proxy_type?(type)\n  type.is_a?(Symbol) && Selenium::WebDriver::Proxy::TYPES.key?(type)\nend","tryCatchPattern":"begin\n  proxy.type = type\nrescue ArgumentError => e\n  raise unless e.message.include?('invalid proxy type')\n  proxy.type = type.to_sym\nend","preventionTips":["Use Symbols from Proxy::TYPES (:direct, :manual, :pac, :auto_detect, :system).","Let the attribute writers (http=, socks=) set the type automatically where possible.","Convert and validate config strings against TYPES.keys before assignment."],"tags":["ruby","proxy","validation","type-error"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}