puppetlabs/puppet · error · Puppet::DataBinding::LookupError

Data Provider type mismatch: Got %{klass} when a hash-like o

Error message

Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'

What it means

Error "Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/lookup/sub_lookup.rb:78

  #
  # @api public
  def sub_lookup(key, context, segments, value)
    lookup_invocation = context.is_a?(Invocation) ? context : context.invocation
    lookup_invocation.with(:sub_lookup, segments) do
      segments.each do |segment|
        lookup_invocation.with(:segment, segment) do
          if value.nil?
            lookup_invocation.report_not_found(segment)
            throw :no_such_key
          end
          if segment.is_a?(Integer) && value.instance_of?(Array)
            unless segment >= 0 && segment < value.size
              lookup_invocation.report_not_found(segment)
              throw :no_such_key
            end
          else
            unless value.respond_to?(:'[]') && !(value.is_a?(Array) || value.instance_of?(String))
              raise Puppet::DataBinding::LookupError,
                    _("Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'") %
                    { klass: value.class.name, segment: segment, key: key }
            end
            unless value.include?(segment)
              lookup_invocation.report_not_found(segment)
              throw :no_such_key
            end
          end
          value = value[segment]
          lookup_invocation.report_found(segment, value)
        end
      end
      value
    end
  end
end
end
end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/lookup/sub_lookup.rb:78 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/7a269b7b21d4af56. Report an issue: GitHub.