RubyMoney/money · error · Money::Currency::UnknownCurrency

Unknown currency '#{id}'

Error message

Unknown currency '#{id}'

What it means

Error "Unknown currency '#{id}'" thrown in RubyMoney/money.

Source

Thrown at lib/money/currency.rb:42

      def initialize(method, currency, attribute)
        super(
          "Can't call Currency.#{method} - currency '#{currency}' is missing " \
          "the attribute '#{attribute}'"
        )
      end
    end

    # Thrown when an unknown currency is requested.
    class UnknownCurrency < ArgumentError; end

    # Thrown when currency is not provided.
    class NoCurrency < ArgumentError; end

    class << self
      def new(id)
        id = id.to_s.downcase
        unless stringified_keys.include?(id)
          raise UnknownCurrency, "Unknown currency '#{id}'"
        end

        _instances[id] || @@mutex.synchronize { _instances[id] ||= super }
      end

      def _instances
        @@instances
      end

      # Lookup a currency with given +id+ an returns a +Currency+ instance on
      # success, +nil+ otherwise.
      #
      # @param [String, Symbol, #to_s] id Used to look into +table+ and
      # retrieve the applicable attributes.
      #
      # @return [Money::Currency]
      #
      # @example

View on GitHub (pinned to 26e2829c34)

When it happens

Trigger: Thrown at lib/money/currency.rb:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of RubyMoney/money@26e2829c34 (2026-08-23). Data as JSON: /api/errors/6e548628fb06f4d2. Report an issue: GitHub.