puppetlabs/puppet · error · ArgumentError

%{function_name}(): the template_args must be a Hash, got a

Error message

%{function_name}(): the template_args must be a Hash, got a %{class_name}

What it means

Error "%{function_name}(): the template_args must be a Hash, got a %{class_name}" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/evaluator/epp_evaluator.rb:114

    # inline_epp() logic sees all local variables, epp() all global
    if use_global_scope_only
      scope.with_global_scope do |global_scope|
        parser.closure(body, global_scope).call_by_name(template_args, enforce_parameters)
      end
    else
      parser.closure(body, scope).call_by_name(template_args, enforce_parameters)
    end
  end
  private_class_method :evaluate

  def self.handle_template_args(func_name, template_args)
    if template_args.nil?
      [{}, false]
    else
      unless template_args.is_a?(Hash)
        # TRANSLATORS 'template_args' is a variable name and should not be translated
        raise ArgumentError, _("%{function_name}(): the template_args must be a Hash, got a %{class_name}") %
                             { function_name: func_name, class_name: template_args.class }
      end
      [template_args, true]
    end
  end
  private_class_method :handle_template_args
end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/epp_evaluator.rb:114 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/cf191cf84eb2306a. Report an issue: GitHub.