puppetlabs/puppet · error · ArgumentError

Unknown function '%{name}'

Error message

Unknown function '%{name}'

What it means

Error "Unknown function '%{name}'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/evaluator/runtime3_support.rb:292

  # @raise [ArgumentError] 'unknown function' if the function does not exist
  #
  def external_call_function(name, args, scope, &block)
    # Call via 4x API if the function exists there
    loaders = scope.compiler.loaders
    # Since this is a call from non puppet code, it is not possible to relate it to a module loader
    # It is known where the call originates by using the scope associated module - but this is the calling scope
    # and it does not defined the visibility of functions from a ruby function's perspective. Instead,
    # this is done from the perspective of the environment.
    loader = loaders.private_environment_loader
    func = loader.load(:function, name) if loader
    if func
      Puppet::Util::Profiler.profile(name, [:functions, name]) do
        return func.call(scope, *args, &block)
      end
    end

    # Call via 3x API if function exists there
    raise ArgumentError, _("Unknown function '%{name}'") % { name: name } unless Puppet::Parser::Functions.function(name)

    # Arguments must be mapped since functions are unaware of the new and magical creatures in 4x.
    # NOTE: Passing an empty string last converts nil/:undef to empty string
    mapped_args = Runtime3FunctionArgumentConverter.map_args(args, scope, '')
    result = scope.send("function_#{name}", mapped_args, &block)
    # Prevent non r-value functions from leaking their result (they are not written to care about this)
    Puppet::Parser::Functions.rvalue?(name) ? result : nil
  end

  def call_function(name, args, o, scope, &block)
    file, line = extract_file_line(o)
    loader = Adapters::LoaderAdapter.loader_for_model_object(o, file)
    func = loader.load(:function, name) if loader
    if func
      Puppet::Util::Profiler.profile(name, [:functions, name]) do
        # Add stack frame when calling.
        return Puppet::Pops::PuppetStack.stack(file || '', line, func, :call, [scope, *args], &block)
      end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/runtime3_support.rb:292 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/d82ebdebdd36f911. Report an issue: GitHub.