puppetlabs/puppet · error · Puppet::Error

Use of an Iterator is not supported here

Error message

Use of an Iterator is not supported here

What it means

Guard in convert_Iterator: an Iterator (a lazy enumeration from a chained function call) reached a context where it must be materialized, and iterators are not supported there.

Solutions

  1. Convert the iterator to an Array first, e.g. $x.map(...) |$v| { ... } becomes an array when assigned
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/runtime3_converter.rb:108 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/f2b49f21079e79fe. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/pops/evaluator/runtime3_converter.rb:108

  def convert_Object(o, scope, undef_value)
    o
  end

  def convert_Array(o, scope, undef_value)
    ic = @inner_converter
    o.map { |x| ic.convert(x, scope, undef_value) }
  end

  def convert_Hash(o, scope, undef_value)
    result = {}
    ic = @inner_converter
    o.each { |k, v| result[ic.convert(k, scope, undef_value)] = ic.convert(v, scope, undef_value) }
    result
  end

  def convert_Iterator(o, scope, undef_value)
    raise Puppet::Error, _('Use of an Iterator is not supported here')
  end

  def convert_Symbol(o, scope, undef_value)
    return o unless o == :undef

    !@inner ? undef_value : nil
  end

  def convert_PAnyType(o, scope, undef_value)
    o
  end

  def convert_PCatalogEntryType(o, scope, undef_value)
    # Since 4x does not support dynamic scoping, all names are absolute and can be
    # used as is (with some check/transformation/mangling between absolute/relative form
    # due to Puppet::Resource's idiosyncratic behavior where some references must be
    # absolute and others cannot be.
    # Thus there is no need to call scope.resolve_type_and_titles to do dynamic lookup.

View on GitHub (pinned to e227c27540)