puppetlabs/puppet · error · ArgumentError

Timestamps are only comparable to Timestamps, Integers, and…

Error message

Timestamps are only comparable to Timestamps, Integers, and Floats

What it means

CompareOperator#cmp_Timestamp guard: a Time::Timestamp can only be ordered against another Timestamp, Integer, or Float.

Solutions

  1. Convert the operand to a Timestamp or numeric value before comparing
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/compare_operator.rb:111 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/3f494a1fb9378fa4. Report an issue: GitHub.

Appendix: source

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

    true
  end

  def cmp_Symbol(a, b)
    if b.is_a?(Symbol)
      a <=> b
    else
      raise ArgumentError, _("Symbol not comparable to non Symbol")
    end
  end

  def cmp_Timespan(a, b)
    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

View on GitHub (pinned to e227c27540)