faker-ruby/faker · error · ArgumentError

Could not find iban details for #{country_code}

Error message

Could not find iban details for #{country_code}

What it means

Error "Could not find iban details for #{country_code}" thrown in faker-ruby/faker.

Source

Thrown at lib/faker/default/bank.rb:44

      # @param country_code [String, nil] Specifies what country prefix is used to generate the iban code. Providing `nil` will use a random country.
      # @return [String]
      #
      # @example
      #   Faker::Bank.iban #=> "GB76DZJM33188515981979"
      #   Faker::Bank.iban(country_code: "be") #=> "BE6375388567752043"
      #   Faker::Bank.iban(country_code: nil) #=> "DE45186738071857270067"
      #
      # @faker.version 1.7.0
      def iban(country_code: 'GB')
        # Each country has its own format for bank accounts
        # Many of them use letters in certain parts of the account
        # Using regex patterns we can create virtually any type of bank account
        country_code ||= iban_country_code

        begin
          pattern = fetch("bank.iban_details.#{country_code.downcase}.bban_pattern")
        rescue I18n::MissingTranslationData
          raise ArgumentError, "Could not find iban details for #{country_code}"
        end

        # Use Faker::Base.regexify for creating a sample from bank account format regex
        account = Base.regexify(/#{pattern}/)

        # Add country code and checksum to the generated account to form valid IBAN
        country_code.upcase + iban_checksum(country_code, account) + account
      end

      ##
      # Produces the ISO 3166 code of a country that uses the IBAN system.
      #
      # @return [String]
      #
      # @example
      #   Faker::Bank.iban_country_code #=> "CH"
      #
      # @faker.version next

View on GitHub (pinned to cca4184947)

When it happens

Trigger: Thrown at lib/faker/default/bank.rb:44 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/0ff49fa9393ea36f. Report an issue: GitHub.