faker-ruby/faker · error · ArgumentError
Length should be 9 or 14
Error message
Length should be 9 or 14
What it means
Error "Length should be 9 or 14" thrown in faker-ruby/faker.
Source
Thrown at lib/faker/default/company.rb:326
loop do
result = Array.new(3) { rand(1..9) } + Array.new(7) { rand(10) }
break if (weight_sum(result, weights) % 11) == result[9]
end
result.join
end
##
# Produces a company polish register of national economy.
#
# @return [String]
#
# @example
# Faker::Company.polish_register_of_national_economy #=> "788435970"
#
# @faker.version 1.9.1
# Get a random Polish register of national economy number. More info https://pl.wikipedia.org/wiki/REGON
def polish_register_of_national_economy(length: 9)
raise ArgumentError, 'Length should be 9 or 14' unless [9, 14].include? length
random_digits = []
loop do
random_digits = Array.new(length) { rand(10) }
break if collect_regon_sum(random_digits) == random_digits.last
end
random_digits.join
end
##
# Produces a company south african pty ltd registration number.
#
# @return [String]
#
# @example
# Faker::Company.south_african_pty_ltd_registration_number #=> "7043/2400717902/07"
#
# @faker.version 1.9.2View on GitHub (pinned to cca4184947)
When it happens
Trigger: Thrown at lib/faker/default/company.rb:326 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/047c983f92750ff4.
Report an issue: GitHub.