{"record":{"id":"ca2f711e3b2a0e48","repo":"puppetlabs/puppet","slug":"only-array-hash-and-object-types-can-be-used-as","errorCode":null,"errorMessage":"Only Array, Hash, and Object types can be used as container types. Got %{type}","messagePattern":"Only Array, Hash, and Object types can be used as container types\\. Got %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/tree_iterators.rb","lineNumber":39,"sourceCode":"  # @param [Hash] options the options\n  # @option options [PTypeType] :container_type ('Variant[Hash, Array, Object]') The type(s) that should be treated as containers. The\n  #   given type(s) must be assignable to the default container_type.\n  # @option options [Boolean] :include_root ('true') If the root container itself should be included in the iteration (requires\n  #   `include_containers` to also be `true` to take effect).\n  # @option options [Boolean] :include_containers ('true') If containers should be included in the iteration\n  # @option options [Boolean] :include_values ('true') If non containers (values) should be included in the iteration\n  # @option options [Boolean] :include_refs ('false') If (non containment) referenced values in Objects should be included\n  #\n  def initialize(enum, options = EMPTY_HASH)\n    @root = enum\n    @element_t = nil\n    @value_stack = [enum]\n    @indexer_stack = []\n    @current_path = []\n    @recursed = false\n    @containers_t = options['container_type'] || DEFAULT_CONTAINERS\n    unless DEFAULT_CONTAINERS.assignable?(@containers_t)\n      raise ArgumentError, _(\"Only Array, Hash, and Object types can be used as container types. Got %{type}\") % { type: @containers_t }\n    end\n\n    @with_root       = extract_option(options, 'include_root', true)\n    @with_containers = extract_option(options, 'include_containers', true)\n    @with_values     = extract_option(options, 'include_values', true)\n    @with_root       = @with_containers && extract_option(options, 'include_root', true)\n    unless @with_containers || @with_values\n      raise ArgumentError, _(\"Options 'include_containers' and 'include_values' cannot both be false\")\n    end\n\n    @include_refs = !!options['include_refs']\n  end\n\n  # Yields each `path, value` if the block arity is 2, and only `value` if arity is 1\n  #\n  def each(&block)\n    loop do\n      if block.arity == 1","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/tree_iterators.rb#L21-L57","documentation":"Error \"Only Array, Hash, and Object types can be used as container types. Got %{type}\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/types/tree_iterators.rb:39 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}