puppetlabs/puppet · error · ArgumentError

create_resources(): wrong number of arguments (%{count}; mus

Error message

create_resources(): wrong number of arguments (%{count}; must be 2 or 3)

What it means

Error "create_resources(): wrong number of arguments (%{count}; must be 2 or 3)" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/parser/functions/create_resources.rb:63

        create_resources("@@user", $myusers)

    The $myusers may be declared as virtual resources using:

        create_resources("@user", $myusers)

    Note that `create_resources` filters out parameter values that are `undef` so that normal
    data binding and Puppet default value expressions are considered (in that order) for the
    final value of a parameter (just as when setting a parameter to `undef` in a Puppet language
    resource declaration).
ENDHEREDOC
  if Puppet[:tasks]
    raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
      Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,
      { :operation => 'create_resources' }
    )
  end

  raise ArgumentError, (_("create_resources(): wrong number of arguments (%{count}; must be 2 or 3)") % { count: args.length }) if args.length > 3
  raise ArgumentError, _('create_resources(): second argument must be a hash') unless args[1].is_a?(Hash)

  if args.length == 3
    raise ArgumentError, _('create_resources(): third argument, if provided, must be a hash') unless args[2].is_a?(Hash)
  end

  type, instances, defaults = args
  defaults ||= {}
  type_name = type.sub(/^@{1,2}/, '').downcase

  # Get file/line information from the Puppet stack (where call comes from in Puppet source)
  # If relayed via other Puppet functions in ruby that do not nest their calls, the source position
  # will be in the original Puppet source.
  #
  file, line = Puppet::Pops::PuppetStack.top_of_stack

  if type.start_with? '@@'
    exported = true

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/parser/functions/create_resources.rb:63 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/86e2753ce49e11bb. Report an issue: GitHub.