{"record":{"id":"38bd78c6f364e061","repo":"puppetlabs/puppet","slug":"use-of-a-ruby-integer-outside-of-puppet-integer","errorCode":null,"errorMessage":"Use of a Ruby Integer outside of Puppet Integer #{range_end} range, got '#{'0x%x' % o}'","messagePattern":"Use of a Ruby Integer outside of Puppet Integer #(.+?) range, got '#(.+?)'","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/evaluator/runtime3_converter.rb","lineNumber":73,"sourceCode":"  #\n  # @param o [Object]The value to convert\n  # @param scope [Puppet::Parser::Scope] The scope to use when converting\n  # @param undef_value [Object] The value that nil is converted to\n  # @return [Object] The converted value\n  #\n  def convert(o, scope, undef_value)\n    @convert_visitor.visit_this_2(self, o, scope, undef_value)\n  end\n\n  def convert_NilClass(o, scope, undef_value)\n    @inner ? nil : undef_value\n  end\n\n  def convert_Integer(o, scope, undef_value)\n    return o unless o < MIN_INTEGER || o > MAX_INTEGER\n\n    range_end = o > MAX_INTEGER ? 'max' : 'min'\n    raise Puppet::Error, \"Use of a Ruby Integer outside of Puppet Integer #{range_end} range, got '#{'0x%x' % o}'\"\n  end\n\n  def convert_BigDecimal(o, scope, undef_value)\n    # transform to same value float value if possible without any rounding error\n    f = o.to_f\n    return f unless f != o\n\n    raise Puppet::Error, \"Use of a Ruby BigDecimal value outside Puppet Float range, got '#{o}'\"\n  end\n\n  def convert_String(o, scope, undef_value)\n    # Although wasteful, a dup is needed because user code may mutate these strings when applying\n    # Resources. This does not happen when in server mode since it only uses Resources that are\n    # in puppet core and those are all safe.\n    o.frozen? && !Puppet.run_mode.server? ? o.dup : o\n  end\n\n  def convert_Object(o, scope, undef_value)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/evaluator/runtime3_converter.rb#L55-L91","documentation":"Range guard in Runtime3Converter#convert_Integer: a Ruby Integer from 3.x function land falls outside Puppet's 64-bit Integer range (below MIN or above MAX) and cannot be represented.","triggerScenarios":"Thrown at lib/puppet/pops/evaluator/runtime3_converter.rb:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Clamp the value to the Puppet Integer range","Pass large numbers as strings and handle them in Ruby"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","contentChangedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}