{"record":{"id":"ee0b9f8bad8dd42f","repo":"puppetlabs/puppet","slug":"unrecognized-option-s-opts","errorCode":null,"errorMessage":"Unrecognized option(s): %{opts}","messagePattern":"Unrecognized option\\(s\\): %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/network/http/connection.rb","lineNumber":49,"sourceCode":"  # @param port [Integer] the port to which this client will connect to\n  # @param options [Hash] options influencing the properties of the created\n  #   connection,\n  # @option options [Boolean] :use_ssl true to connect with SSL, false\n  #   otherwise, defaults to true\n  # @option options [Puppet::SSL::Verifier] :verifier An object that will configure\n  #   any verification to do on the connection\n  # @option options [Integer] :redirect_limit the number of allowed\n  #   redirections, defaults to 10 passing any other option in the options\n  #   hash results in a Puppet::Error exception\n  #\n  # @note the HTTP connection itself happens lazily only when {#request}, or\n  #   one of the {#get}, {#post}, {#delete}, {#head} or {#put} is called\n  # @note The correct way to obtain a connection is to use one of the factory\n  #   methods on {Puppet::Network::HttpPool}\n  # @api private\n  def initialize(host, port, options = {})\n    unknown_options = options.keys - OPTION_DEFAULTS.keys\n    raise Puppet::Error, _(\"Unrecognized option(s): %{opts}\") % { opts: unknown_options.map(&:inspect).sort.join(', ') } unless unknown_options.empty?\n\n    options = OPTION_DEFAULTS.merge(options)\n    @use_ssl = options[:use_ssl]\n    if @use_ssl\n      unless options[:verifier].is_a?(Puppet::SSL::Verifier)\n        raise ArgumentError, _(\"Expected an instance of Puppet::SSL::Verifier but was passed a %{klass}\") % { klass: options[:verifier].class }\n      end\n\n      @verifier = options[:verifier]\n    end\n    @redirect_limit = options[:redirect_limit]\n    @site = Puppet::HTTP::Site.new(@use_ssl ? 'https' : 'http', host, port)\n    @client = Puppet.runtime[:http]\n  end\n\n  # The address to connect to.\n  def address\n    @site.host","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/network/http/connection.rb#L31-L67","documentation":"Puppet::Network::HTTP::Connection's constructor accepts only a fixed option set defined by OPTION_DEFAULTS: :use_ssl, :verifier and :redirect_limit. Any other key in the options hash raises Puppet::Error listing the unrecognized options (sorted, inspected). This hard validation replaced the lenient option handling of older Puppet versions when the HTTP stack was reworked.","triggerScenarios":"Calling Puppet::Network::HTTP::Connection.new(host, port, verify: false) or passing legacy keys like :ssl_context or timeout settings; reusing Puppet 4-era HttpPool option hashes verbatim against this class.","commonSituations":"Upgrading Puppet 4 to 5/6 where the internal HTTP API changed; copy-pasted connection code from old blog posts; scripts trying to disable SSL verification the old way.","solutions":["Remove the unsupported keys; the accepted options are use_ssl, verifier and redirect_limit","Replace verify: false by passing a Puppet::SSL::Verifier (or use_ssl: false for plain HTTP)","Migrate to the non-deprecated Puppet.runtime[:http] client, which takes these concerns differently","Check OPTION_DEFAULTS in lib/puppet/network/http/connection.rb for your Puppet version before passing options"],"exampleFix":"# before\nconn = Puppet::Network::HTTP::Connection.new('puppet', 8140, verify: false)\n\n# after\nverifier = Puppet::SSL::Verifier.new('puppet', ssl_context)\nconn = Puppet::Network::HTTP::Connection.new('puppet', 8140, use_ssl: true, verifier: verifier)","handlingStrategy":"validation","validationCode":"ALLOWED_OPTIONS = %i[use_ssl verifier redirect_limit].freeze\n\noptions.each_key do |k|\n  raise ArgumentError, \"unsupported option #{k.inspect}\" unless ALLOWED_OPTIONS.include?(k)\nend\nPuppet::Network::HTTP::Connection.new(host, port, options)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin option keys to the version's OPTION_DEFAULTS before constructing the connection","Wrap connection creation in one helper so API changes surface in a single place"],"tags":["http-client","options","validation","api-misuse"],"backgroundTag":"unsupported-option-key","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}