{"record":{"id":"e26f6d09530edc58","repo":"bblimke/webmock","slug":"invalid-notation-must-be-one-of-flat-dot-s","errorCode":null,"errorMessage":"Invalid notation. Must be one of: [:flat, :dot, :subscript, :flat_array].","messagePattern":"Invalid notation\\. Must be one of: \\[:flat, :dot, :subscript, :flat_array\\]\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/webmock/util/query_mapper.rb","lineNumber":49,"sourceCode":"      #   WebMock::Util::QueryMapper.query_to_values(\"?one.two.three=four\",\n      #     :notation => :flat\n      #   )\n      #   #=> {\"one.two.three\" => \"four\"}\n      #   WebMock::Util::QueryMapper(\n      #     \"?one[two][three][]=four&one[two][three][]=five\"\n      #   )\n      #   #=> {\"one\" => {\"two\" => {\"three\" => [\"four\", \"five\"]}}}\n      #   WebMock::Util::QueryMapper.query_to_values(\n      #     \"?one=two&one=three\").query_values(:notation => :flat_array)\n      #   #=> [['one', 'two'], ['one', 'three']]\n      def query_to_values(query, options={})\n        return nil if query.nil?\n        query = query.dup.force_encoding('utf-8') if query.respond_to?(:force_encoding)\n\n        options[:notation] ||= :subscript\n\n        if ![:flat, :dot, :subscript, :flat_array].include?(options[:notation])\n          raise ArgumentError,\n                'Invalid notation. Must be one of: ' +\n                '[:flat, :dot, :subscript, :flat_array].'\n        end\n\n        empty_accumulator = :flat_array == options[:notation] ? [] : {}\n\n        query_array = collect_query_parts(query)\n\n        query_hash = collect_query_hash(query_array, empty_accumulator, options)\n\n        normalize_query_hash(query_hash, empty_accumulator, options)\n      end\n\n      def normalize_query_hash(query_hash, empty_accumulator, options)\n        query_hash.inject(empty_accumulator.dup) do |accumulator, (key, value)|\n          if options[:notation] == :flat_array\n            accumulator << [key, value]\n          else","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/bblimke/webmock/blob/b187df8827e1f08a1684a8ddc0a5050dbd449c16/lib/webmock/util/query_mapper.rb#L31-L67","documentation":"WebMock::Util::QueryMapper.query_to_values parses a query string into a Hash (or array of pairs); the notation option selects how nested and repeated keys are represented, and only :flat, :dot, :subscript and :flat_array are accepted. ArgumentError is raised for any other value. The check guards direct util calls as well as internal paths that build request signatures and stub query params (add_query_params, body_as_hash, TyphoeusAdapter, etc.).","triggerScenarios":"Calling WebMock::Util::QueryMapper.query_to_values(query, notation: X) with X outside the whitelist: :array, :rack, :addressable, the string 'flat' instead of the symbol :flat, or an options hash where notation is set to nil before the default is applied; custom adapters or plugins layered on QueryMapper after an upgrade renamed notations.","commonSituations":"Code copied from webmock internals or old Stack Overflow answers using pre-2.0 notation names; upgrading webmock 1.x to 2.x (the query mapper was rewritten); pulling notation from config or ENV so it arrives as a String; gems or monkey-patches calling QueryMapper with their own notation vocabulary.","solutions":["Use exactly one of the four symbols: :flat, :dot, :subscript, :flat_array (symbol, not string)","Map old names: array-style params (a[]=1) are :subscript; [key, value] pair lists are :flat_array; dot-notation nesting (a.b=1) is :dot","Avoid depending on WebMock::Util internals - parse queries yourself with Addressable::URI#query_values"],"exampleFix":"// before\nvalues = WebMock::Util::QueryMapper.query_to_values('a=1&a=2', notation: :array)\n# => ArgumentError: Invalid notation...\n\n// after\nvalues = WebMock::Util::QueryMapper.query_to_values('a=1&a=2', notation: :flat_array)","handlingStrategy":"validation","validationCode":"VALID_NOTATIONS = %i[flat dot subscript flat_array].freeze\n\nnotation = :flat_array\nraise ArgumentError, \"notation must be one of #{VALID_NOTATIONS}\" unless VALID_NOTATIONS.include?(notation)\nvalues = WebMock::Util::QueryMapper.query_to_values('a=1&b=2', notation: notation)","typeGuard":"def valid_query_notation?(value)\n  %i[flat dot subscript flat_array].include?(value)\nend","tryCatchPattern":null,"preventionTips":["Treat WebMock::Util::QueryMapper as private API - prefer Addressable::URI#query_values for your own parsing","Always pass notation as a Symbol","Keep a unit test over any custom query-mapping helper so webmock upgrades surface renamed notations"],"tags":["webmock","ruby","query-string","argumenterror","notation"],"backgroundTag":"invalid-argument-value","analyzedSha":"b187df8827e1f08a1684a8ddc0a5050dbd449c16","analyzedAt":"2026-08-23T02:55:22.028Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}