SeleniumHQ/selenium · error · ArgumentError

unsupported proxy type #{proxy.type}

Error message

unsupported proxy type #{proxy.type}

What it means

Raised by Firefox::Profile#proxy= (ArgumentError) when proxy.type is anything other than :manual, :pac, or :auto_detect. The Firefox profile proxy setter only maps these three Selenium proxy types to network.proxy.* preferences; types like :system, :direct, or nil fall into the else branch.

Source

Thrown at rb/lib/selenium/webdriver/firefox/profile.rb:155

        def proxy=(proxy)
          raise TypeError, "expected #{Proxy.name}, got #{proxy.inspect}:#{proxy.class}" unless proxy.is_a? Proxy

          case proxy.type
          when :manual
            self['network.proxy.type'] = 1

            set_manual_proxy_preference 'http', proxy.http
            set_manual_proxy_preference 'ssl', proxy.ssl
            set_manual_proxy_preference 'socks', proxy.socks

            self['network.proxy.no_proxies_on'] = proxy.no_proxy || ''
          when :pac
            self['network.proxy.type'] = 2
            self['network.proxy.autoconfig_url'] = proxy.pac
          when :auto_detect
            self['network.proxy.type'] = 4
          else
            raise ArgumentError, "unsupported proxy type #{proxy.type}"
          end
        end

        alias as_json encoded

        private

        def set_manual_proxy_preference(key, value)
          return unless value

          host, port = value.to_s.split(':', 2)

          self["network.proxy.#{key}"] = host
          self["network.proxy.#{key}_port"] = Integer(port) if port
        end

        def install_extensions(directory)
          destination = File.join(directory, 'extensions')

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Use one of the supported types (:manual, :pac, :auto_detect) for the Firefox profile.
  2. For system/direct proxy behavior, configure it differently (e.g. omit the profile proxy and rely on Firefox defaults, or set network.proxy.type manually via profile[]=).
  3. Prefer setting proxy on Capabilities/options where broader type support may apply.

Example fix

// before
profile.proxy = Selenium::WebDriver::Proxy.new(type: :system)

// after
profile.proxy = Selenium::WebDriver::Proxy.new(type: :auto_detect)
# or set network.proxy.type directly for 'system' behavior
profile['network.proxy.type'] = 5
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = %i[manual pac auto_detect]
unless SUPPORTED.include?(proxy.type)
  raise "Firefox profile proxy supports #{SUPPORTED}, got #{proxy.type}"
end
profile.proxy = proxy

Prevention

When it happens

Trigger: Assigning a Proxy whose type is :system, :direct, or unset/nil to profile.proxy=.

Common situations: Using a Proxy intended for Chrome/Edge (which support :system) on a Firefox profile; reading proxy type from environment/config that yields :system or :direct.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/ef8b6220dd0853f3. Report an issue: GitHub.