puppetlabs/puppet · error · ArgumentError

Puppet::Resource.new does not take a hash as the first argum

Error message

Puppet::Resource.new does not take a hash as the first argument. Did you mean (%{type}, %{title}) ?

What it means

Error "Puppet::Resource.new does not take a hash as the first argument. Did you mean (%{type}, %{title}) ?" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/resource.rb:303

        case v
        when Puppet::Resource
          v = v.copy_as_resource
        when Array
          # flatten resource references arrays
          v = v.flatten if v.flatten.find { |av| av.is_a?(Puppet::Resource) }
          v = v.collect do |av|
            av = av.copy_as_resource if av.is_a?(Puppet::Resource)
            av
          end
        end

        self[p] = v
      end
      @sensitive_parameters.replace(type.sensitive_parameters)
    else
      if type.is_a?(Hash)
        # TRANSLATORS 'Puppet::Resource.new' should not be translated
        raise ArgumentError, _("Puppet::Resource.new does not take a hash as the first argument.") + ' ' +
                             _("Did you mean (%{type}, %{title}) ?") %
                             { type: (type[:type] || type["type"]).inspect, title: (type[:title] || type["title"]).inspect }
      end

      # In order to avoid an expensive search of 'known_resource_types" and
      # to obey/preserve the implementation of the resource's type - if the
      # given type is a resource type implementation (one of):
      #   * a "classic" 3.x ruby plugin
      #   * a compatible implementation (e.g. loading from pcore metadata)
      #   * a resolved user defined type
      #
      # ...then, modify the parameters to the "old" (agent side compatible) way
      # of describing the type/title with string/symbols.
      #
      # TODO: Further optimizations should be possible as the "type juggling" is
      # not needed when the type implementation is known.
      #
      if type.is_a?(Puppet::CompilableResourceType) || type.is_a?(Puppet::Resource::Type)

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/resource.rb:303 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/1229c3eeace7e444. Report an issue: GitHub.