{"record":{"id":"7f8feb19cb277c41","repo":"puppetlabs/puppet","slug":"unknown-arguments-args","errorCode":null,"errorMessage":"Unknown arguments: %{args}","messagePattern":"Unknown arguments: %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/network/http/request.rb","lineNumber":22,"sourceCode":"# parameter to the current Handler subclass. Puppetserver implements its own\n# Handler\n# https://github.com/puppetlabs/puppetserver/blob/8.3.0/src/ruby/puppetserver-lib/puppet/server/network/http/handler.rb#L9\n# and the Request object is passed to its Handler#body method\n# https://github.com/puppetlabs/puppetserver/blob/8.3.0/src/ruby/puppetserver-lib/puppet/server/network/http/handler.rb#L36\nPuppet::Network::HTTP::Request = Struct.new(:headers, :params, :method, :path, :routing_path, :client_cert, :body) do # rubocop:disable Lint/StructNewOverride\n  def self.from_hash(hash)\n    symbol_members = members.collect(&:intern)\n    unknown = hash.keys - symbol_members\n    if unknown.empty?\n      new(hash[:headers] || {},\n          hash[:params] || {},\n          hash[:method] || \"GET\",\n          hash[:path],\n          hash[:routing_path] || hash[:path],\n          hash[:client_cert],\n          hash[:body])\n    else\n      raise ArgumentError, _(\"Unknown arguments: %{args}\") % { args: unknown.collect(&:inspect).join(', ') }\n    end\n  end\n\n  def route_into(prefix)\n    self.class.new(headers, params, method, path, routing_path.sub(prefix, ''), client_cert, body)\n  end\n\n  def formatter\n    header = headers['content-type']\n    if header\n      header.gsub!(/\\s*;.*$/, '') # strip any charset\n      format = Puppet::Network::FormatHandler.mime(header)\n\n      return format if valid_network_format?(format)\n\n      # TRANSLATORS \"mime-type\" is a keyword and should not be translated\n      raise Puppet::Network::HTTP::Error::HTTPUnsupportedMediaTypeError.new(\n        _(\"Client sent a mime-type (%{header}) that doesn't correspond to a format we support\") % { header: headers['content-type'] },","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/network/http/request.rb#L4-L40","documentation":"Puppet::Network::HTTP::Request.from_hash builds a Request struct from a hash and rejects any key that is not one of its members: headers, params, method, path, routing_path, client_cert, body. Unknown keys raise ArgumentError listing the inspected names, catching typos and stale field names before a malformed request object exists.","triggerScenarios":"Passing a hash containing extra keys such as peer_ip or remote_address; building requests in custom WEBrick/Rack adapters whose dictionaries were written for an older Puppet's Request; merging foreign hashes into the request hash before calling from_hash.","commonSituations":"Upgrading Puppet where Request gained members (routing_path, client_cert) and adapter code drifted; third-party rack handlers not yet updated for the new Puppet; typo'd keys (':header' instead of ':headers').","solutions":["Whitelist keys before calling: hash = hash.slice(:headers, :params, :method, :path, :routing_path, :client_cert, :body)","Rename stale keys to the current members listed in the error message","Update the third-party adapter/handler gem to a version matching your Puppet version"],"exampleFix":"# before\nPuppet::Network::HTTP::Request.from_hash(params.merge(peer_ip: ip))\n\n# after\nPuppet::Network::HTTP::Request.from_hash(\n  params.slice(:headers, :params, :method, :path, :routing_path, :client_cert, :body)\n)","handlingStrategy":"validation","validationCode":"REQUEST_MEMBERS = %i[headers params method path routing_path client_cert body].freeze\n\nrequest_hash = request_hash.select { |k, _| REQUEST_MEMBERS.include?(k) }\nPuppet::Network::HTTP::Request.from_hash(request_hash)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter request hashes at the boundary instead of passing foreign dicts through","Keep a regression spec that constructs Requests exactly as your adapter does, so member drift is caught on upgrade"],"tags":["http","request","validation","api-misuse"],"backgroundTag":"unknown-argument-keys","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}