faker-ruby/faker · error · ArgumentError

min_length should be at least #{required_min_length} to enab

Error message

min_length should be at least #{required_min_length} to enable #{character_types.join(', ')} configuration

What it means

Error "min_length should be at least #{required_min_length} to enable #{character_types.join(', ')} configuration" thrown in faker-ruby/faker.

Source

Thrown at lib/faker/internet.rb:147

      # @faker.version 2.1.3
      def password(min_length: 8, max_length: 16, mix_case: true, special_characters: false)
        raise ArgumentError, 'min_length and max_length must be greater than or equal to one' if min_length < 1 || max_length < 1
        raise ArgumentError, 'min_length must be smaller than or equal to max_length' unless min_length <= max_length

        character_types = []
        required_min_length = 0

        if mix_case
          character_types << :mix_case
          required_min_length += 2
        end

        if special_characters
          character_types << :special_characters
          required_min_length += 1
        end

        raise ArgumentError, "min_length should be at least #{required_min_length} to enable #{character_types.join(', ')} configuration" if min_length < required_min_length

        target_length = rand(min_length..max_length)

        password = []
        character_bag = []

        # use lower_chars by default and add upper_chars if mix_case
        lower_chars = self::LLetters
        password << sample(lower_chars)
        character_bag += lower_chars

        digits = ('0'..'9').to_a
        password << sample(digits)
        character_bag += digits

        if mix_case
          upper_chars = self::ULetters
          password << sample(upper_chars)

View on GitHub (pinned to cca4184947)

When it happens

Trigger: Thrown at lib/faker/internet.rb:147 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/ade7cc7caed7a4c2. Report an issue: GitHub.