{"record":{"id":"7a269b7b21d4af56","repo":"puppetlabs/puppet","slug":"data-provider-type-mismatch-got-klass-when-a-h","errorCode":null,"errorMessage":"Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'","messagePattern":"Data Provider type mismatch: Got %(.+?) when a hash-like object was expected to access value using '%(.+?)' from key '%(.+?)'","errorType":"exception","errorClass":"Puppet::DataBinding::LookupError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/lookup/sub_lookup.rb","lineNumber":78,"sourceCode":"  #\n  # @api public\n  def sub_lookup(key, context, segments, value)\n    lookup_invocation = context.is_a?(Invocation) ? context : context.invocation\n    lookup_invocation.with(:sub_lookup, segments) do\n      segments.each do |segment|\n        lookup_invocation.with(:segment, segment) do\n          if value.nil?\n            lookup_invocation.report_not_found(segment)\n            throw :no_such_key\n          end\n          if segment.is_a?(Integer) && value.instance_of?(Array)\n            unless segment >= 0 && segment < value.size\n              lookup_invocation.report_not_found(segment)\n              throw :no_such_key\n            end\n          else\n            unless value.respond_to?(:'[]') && !(value.is_a?(Array) || value.instance_of?(String))\n              raise Puppet::DataBinding::LookupError,\n                    _(\"Data Provider type mismatch: Got %{klass} when a hash-like object was expected to access value using '%{segment}' from key '%{key}'\") %\n                    { klass: value.class.name, segment: segment, key: key }\n            end\n            unless value.include?(segment)\n              lookup_invocation.report_not_found(segment)\n              throw :no_such_key\n            end\n          end\n          value = value[segment]\n          lookup_invocation.report_found(segment, value)\n        end\n      end\n      value\n    end\n  end\nend\nend\nend","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/lookup/sub_lookup.rb#L60-L96","documentation":"SubLookup tried to descend a lookup key segment into a value that is neither a Hash nor an Array-with-integer-segment: the data structure does not have the hash-like shape the dotted key requires.","triggerScenarios":"Thrown at lib/puppet/pops/lookup/sub_lookup.rb:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the data so intermediate values along the key path are hashes (or arrays indexed numerically)","Adjust the lookup key to match the actual data shape"],"exampleFix":null,"handlingStrategy":"type-guard","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"}