{"record":{"id":"3110dcd539c28c17","repo":"faker-ruby/faker","slug":"given-argument-is-too-large","errorCode":null,"errorMessage":"Given argument is too large","messagePattern":"Given argument is too large","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/faker/internet.rb","lineNumber":78,"sourceCode":"      # @param specifier [Integer, Range, String] When int value passed it returns the username longer than specifier. Max value can be 10^6\n      # @param separators [Array]\n      #\n      # @example\n      #   Faker::Internet.username(specifier: 10)                     #=> \"lulu.goodwin\"\n      #   Faker::Internet.username(specifier: 5..10)                  #=> \"morris\"\n      #   Faker::Internet.username(specifier: 5..10)                  #=> \"berryberry\"\n      #   Faker::Internet.username(specifier: 20, separators: ['_'])  #=> \"nikki_sawaynnikki_saway\"\n      def username(specifier: nil, separators: %w[. _])\n        with_locale(:en) do\n          case specifier\n          when ::String\n            names = specifier.gsub(\"'\", '').scan(/[[:word:]]+/)\n            shuffled_names = shuffle(names)\n\n            return shuffled_names.join(sample(separators)).downcase\n          when Integer\n            # If specifier is Integer and has large value, Argument error exception is raised to overcome memory full error\n            raise ArgumentError, 'Given argument is too large' if specifier > 10**6\n\n            tries = 0 # Don't try forever in case we get something like 1_000_000.\n            result = nil\n            loop do\n              result = username(specifier: nil, separators: separators)\n              tries += 1\n              break unless result.length < specifier && tries < 7\n            end\n            return result * (specifier / result.length + 1) if specifier.positive?\n          when Range\n            tries = 0\n            result = nil\n            loop do\n              result = username(specifier: specifier.min, separators: separators)\n              tries += 1\n              break unless !specifier.include?(result.length) && tries < 7\n            end\n            return result[0...specifier.max]","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/faker-ruby/faker/blob/cca4184947e09fdd02afb8b89d25a9c8ebc7274e/lib/faker/internet.rb#L60-L96","documentation":"Error \"Given argument is too large\" thrown in faker-ruby/faker.","triggerScenarios":"Thrown at lib/faker/internet.rb:78 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"}