{"record":{"id":"80eae7006e40f1aa","repo":"puppetlabs/puppet","slug":"create-resources-second-argument-must-be-a-hash","errorCode":null,"errorMessage":"create_resources(): second argument must be a hash","messagePattern":"create_resources\\(\\): second argument must be a hash","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/parser/functions/create_resources.rb","lineNumber":64,"sourceCode":"\n    The $myusers may be declared as virtual resources using:\n\n        create_resources(\"@user\", $myusers)\n\n    Note that `create_resources` filters out parameter values that are `undef` so that normal\n    data binding and Puppet default value expressions are considered (in that order) for the\n    final value of a parameter (just as when setting a parameter to `undef` in a Puppet language\n    resource declaration).\nENDHEREDOC\n  if Puppet[:tasks]\n    raise Puppet::ParseErrorWithIssue.from_issue_and_stack(\n      Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,\n      { :operation => 'create_resources' }\n    )\n  end\n\n  raise ArgumentError, (_(\"create_resources(): wrong number of arguments (%{count}; must be 2 or 3)\") % { count: args.length }) if args.length > 3\n  raise ArgumentError, _('create_resources(): second argument must be a hash') unless args[1].is_a?(Hash)\n\n  if args.length == 3\n    raise ArgumentError, _('create_resources(): third argument, if provided, must be a hash') unless args[2].is_a?(Hash)\n  end\n\n  type, instances, defaults = args\n  defaults ||= {}\n  type_name = type.sub(/^@{1,2}/, '').downcase\n\n  # Get file/line information from the Puppet stack (where call comes from in Puppet source)\n  # If relayed via other Puppet functions in ruby that do not nest their calls, the source position\n  # will be in the original Puppet source.\n  #\n  file, line = Puppet::Pops::PuppetStack.top_of_stack\n\n  if type.start_with? '@@'\n    exported = true\n    virtual = true","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/parser/functions/create_resources.rb#L46-L82","documentation":"Error \"create_resources(): second argument must be a hash\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/parser/functions/create_resources.rb:64 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"}