{"record":{"id":"2a17e35f2145a835","repo":"faker-ruby/faker","slug":"min-length-and-max-length-must-be-greater-than-or","errorCode":null,"errorMessage":"min_length and max_length must be greater than or equal to one","messagePattern":"min_length and max_length must be greater than or equal to one","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/faker/internet.rb","lineNumber":131,"sourceCode":"      # @param mix_case [Boolean] Toggles if uppercased letters are allowed. If true, at least one will be added.\n      # @param special_characters [Boolean] Toggles if special characters are allowed. If true, at least one will be added.\n      #\n      # @return [String]\n      #\n      # @example\n      #   Faker::Internet.password #=> \"Vg5mSvY1UeRg7\"\n      # @example\n      #   Faker::Internet.password(min_length: 8) #=> \"YfGjIk0hGzDqS0\"\n      # @example\n      #   Faker::Internet.password(min_length: 10, max_length: 20) #=> \"EoC9ShWd1hWq4vBgFw\"\n      # @example\n      #   Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true) #=> \"3k5qS15aNmG\"\n      # @example\n      #   Faker::Internet.password(min_length: 10, max_length: 20, mix_case: true, special_characters: true) #=> \"*%NkOnJsH4\"\n      #\n      # @faker.version 2.1.3\n      def password(min_length: 8, max_length: 16, mix_case: true, special_characters: false)\n        raise ArgumentError, 'min_length and max_length must be greater than or equal to one' if min_length < 1 || max_length < 1\n        raise ArgumentError, 'min_length must be smaller than or equal to max_length' unless min_length <= max_length\n\n        character_types = []\n        required_min_length = 0\n\n        if mix_case\n          character_types << :mix_case\n          required_min_length += 2\n        end\n\n        if special_characters\n          character_types << :special_characters\n          required_min_length += 1\n        end\n\n        raise ArgumentError, \"min_length should be at least #{required_min_length} to enable #{character_types.join(', ')} configuration\" if min_length < required_min_length\n\n        target_length = rand(min_length..max_length)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/faker-ruby/faker/blob/cca4184947e09fdd02afb8b89d25a9c8ebc7274e/lib/faker/internet.rb#L113-L149","documentation":"Error \"min_length and max_length must be greater than or equal to one\" thrown in faker-ruby/faker.","triggerScenarios":"Thrown at lib/faker/internet.rb:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cca4184947e09fdd02afb8b89d25a9c8ebc7274e","analyzedAt":"2026-08-21T16:25:39.145Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}