flippercloud/flipper · error · ArgumentError

#{value.inspect} cannot be converted to a float

Error message

#{value.inspect} cannot be converted to a float

What it means

Error "#{value.inspect} cannot be converted to a float" thrown in flippercloud/flipper.

Source

Thrown at lib/flipper/typecast.rb:38

    # Internal: Convert value to an integer.
    #
    # Returns an Integer representation of the value.
    # Raises ArgumentError if conversion is not possible.
    def self.to_integer(value)
      value.to_i
    rescue NoMethodError
      raise ArgumentError, "#{value.inspect} cannot be converted to an integer"
    end

    # Internal: Convert value to a float.
    #
    # Returns a Float representation of the value.
    # Raises ArgumentError if conversion is not possible.
    def self.to_float(value)
      value.to_f
    rescue NoMethodError
      raise ArgumentError, "#{value.inspect} cannot be converted to a float"
    end

    # Internal: Convert value to a number.
    #
    # Returns a Integer or Float representation of the value.
    # Raises ArgumentError if conversion is not possible.
    def self.to_number(value)
      case value
      when Numeric
        value
      when String
        value.include?('.') ? to_float(value) : to_integer(value)
      when NilClass
        0
      else
        value.to_f
      end
    rescue NoMethodError

View on GitHub (pinned to 1f86de3ec9)

Solutions

  1. Pass a Float/Numeric or a numeric String; other types cannot be typecast
  2. Convert the value with to_f before passing it to Flipper
  3. Check the source of the value; nil or arbitrary objects are rejected

When it happens

Trigger: Thrown at lib/flipper/typecast.rb:38 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of flippercloud/flipper@1f86de3ec9 (2026-08-23). Data as JSON: /api/errors/bfcee3d9c39e36c9. Report an issue: GitHub.