faker-ruby/faker · error · ArgumentError

Invalid HTTP status code group

Error message

Invalid HTTP status code group

What it means

Error "Invalid HTTP status code group" thrown in faker-ruby/faker.

Source

Thrown at lib/faker/internet/http.rb:41

        #
        # @example
        #   Faker::Internet::HTTP.status_code #=> 418
        # @example
        #   Faker::Internet::HTTP.status_code(group: :information) #=> 102
        # @example
        #   Faker::Internet::HTTP.status_code(group: :successful) #=> 200
        # @example
        #   Faker::Internet::HTTP.status_code(group: :redirect) #=> 306
        # @example
        #   Faker::Internet::HTTP.status_code(group: :client_error) #=> 451
        # @example
        #   Faker::Internet::HTTP.status_code(group: :server_error) #=> 502
        #
        # @faker.version 2.13.0
        def status_code(group: nil)
          return STATUS_CODES[STATUS_CODES_GROUPS.sample].sample unless group

          raise ArgumentError, 'Invalid HTTP status code group' unless STATUS_CODES_GROUPS.include?(group)

          STATUS_CODES[group].sample
        end
      end
    end
  end
end

View on GitHub (pinned to cca4184947)

When it happens

Trigger: Thrown at lib/faker/internet/http.rb:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of faker-ruby/faker@cca4184947 (2026-08-21). Data as JSON: /api/errors/5d92a93f0fced432. Report an issue: GitHub.