puppetlabs/puppet · error · ArgumentError

Only Strings, Numbers, Timespans, Timestamps, and Versions a

Error message

Only Strings, Numbers, Timespans, Timestamps, and Versions are comparable

What it means

Error "Only Strings, Numbers, Timespans, Timestamps, and Versions are comparable" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/evaluator/compare_operator.rb:123

    raise ArgumentError, _('Timespans are only comparable to Timespans, Integers, and Floats') unless b.is_a?(Time::Timespan) || b.is_a?(Integer) || b.is_a?(Float)

    a <=> b
  end

  def cmp_Timestamp(a, b)
    raise ArgumentError, _('Timestamps are only comparable to Timestamps, Integers, and Floats') unless b.is_a?(Time::Timestamp) || b.is_a?(Integer) || b.is_a?(Float)

    a <=> b
  end

  def cmp_Version(a, b)
    raise ArgumentError, _('Versions not comparable to non Versions') unless b.is_a?(SemanticPuppet::Version)

    a <=> b
  end

  def cmp_Object(a, b)
    raise ArgumentError, _('Only Strings, Numbers, Timespans, Timestamps, and Versions are comparable')
  end

  def equals_Object(a, b)
    a == b
  end

  def equals_NilClass(a, b)
    # :undef supported in case it is passed from a 3x data structure
    b.nil? || b == :undef
  end

  def equals_Symbol(a, b)
    # :undef supported in case it is passed from a 3x data structure
    a == b || a == :undef && b.nil?
  end

  def include_Object(a, b, scope)
    false

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/compare_operator.rb:123 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/0f278921d79c8d53. Report an issue: GitHub.