faker-ruby/faker · error · ArgumentError

'#{argument}' not found, #{argument_name} can be blank, or o

Error message

'#{argument}' not found, #{argument_name} can be blank, or one of the following, as strings: #{correct_values.join(', ')}

What it means

Error "'#{argument}' not found, #{argument_name} can be blank, or one of the following, as strings: #{correct_values.join(', ')}" thrown in faker-ruby/faker.

Source

Thrown at lib/faker/travel/train_station.rb:49

          types = %w[metro railway]

          if region.nil? && type.nil?
            region = sample(regions)
            type = sample(types)
          elsif region.nil?
            validate_arguments(type, types, 'type')
            region = sample(regions)
          elsif type.nil?
            validate_arguments(region, regions, 'region')
            type = sample(types)
          end
          [region, type]
        end

        def validate_arguments(argument, correct_values, argument_name)
          return if correct_values.include?(argument)

          raise ArgumentError, "'#{argument}' not found, #{argument_name} can be blank, or one of the following, as strings: #{correct_values.join(', ')}"
        end
      end
    end
  end
end

View on GitHub (pinned to cca4184947)

When it happens

Trigger: Thrown at lib/faker/travel/train_station.rb:49 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/b84ffdcded690a3c. Report an issue: GitHub.